Yab(asic) for newbies

Generally ID$ is the name you are giving this widget or view being created, while View$ is the name of the view or Window to place your view or widget on.

2 Likes

First you need to add tabs to the tabview:

TABVIEW x1,y1 TO x2,y2, ID$, Option$, View$

** View$ is the name of the view or window you are place the tabview on.

Generates a View for Tabs with the ID$ (internal name of the Tabview)

Then you need to add tabviews:

TABVIEW ADD ID$, “Displayed Name of View”

If you want to place anything on it you need to tell it on which tab. This is by the number you add the tabs to the tabview:

BUTTON 0,0 TO 100,20, ID$, “Displayed Name of Button”, “Tabviewname1” (ID$+“1”)

If you add more then one:

BUTTON 0,0 TO 100,20, ID$, “Displayed Name of Button”, “Tabviewname2” (ID$+“2”)

and so on

2 Likes

My current yab beginners tutorial are here:

http://old.besly.de/menu/search/archiv/dev/yab_shelltool_gui.html

Because the old one are not up to date (written long time ago):

http://old.besly.de/menu/search/archiv/dev/yab_tutorial_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_tutorial2_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_game_tutorial_eng.html

This are the main tutorials for the beginner…

http://old.besly.de/menu/search/archiv/dev/yab_ide_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_wasistwas_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_layout_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_chr_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_laws.html

3 Likes

Thank you both for your replies. I’ll do more experimentation when I’ll have more time. For now I tested the tabview on top of a view, then without a view - directly on the window. Both work, but the IDE’s documentation doesn’t mention anything about their significance. I didn’t have enough time to also read the online documentation, but I will. Is there a reason to use the view between the main window and a tab view?

Anyway, I hope the IDE’s documentation will be updated to clarify these things. Is it somewhere on a git scm? I found some minor issues in various places and I could send the fixes as pull requests.

tabview set:

  • “Synopsys” (mistyped)
  • Related: tabview tabview add, tasbview get (plus missing comma after the first tabview)

tabview get: also missing a comma after the first tabview

I does not clearly understand what you mean. The window is a view himself, if you place a view on it you know its name id$. If you place a tabview on it, you use it already :).

@bbjimmy gave me this example: window -> view -> tabview. So I asked because the documentation doesn’t make it clear what is necessary for a tabview, and what’s the role of views.

in the case one needs to add / remove tabs based on user input. Tabview has no way to remove a tab, but one could remove the containing view, re-add it and the tabview, then and the required tabs.

example:

screenWidth = peek("desktopwidth")
screenHeight = peek("desktopheight")


window open screenWidth/2-200, screenHeight/2-200 to screenWidth/2+200, screenHeight/2+200, "MainWindow", "Test"

VIEW 0,0 TO 400,320, "BackgroundView","MainWindow"
TABVIEW 5,2 TO 395,300, "Test", "top", "BackgroundView"
	TABVIEW ADD "Test",  "Tab1"
	BUTTON 5,5 TO 105,25, "BT:Hui", "Hui", "Test1"
	TABVIEW ADD "Test",  "Tab2"
	
	

BUTTON 5,350 TO 100,375, "BT:Remove", "Remove", "MainWindow"
BUTTON 105,350 TO 200,375, "BT:Add", "Add", "MainWindow"

dim part$(1)

inloop = true
while(inloop)

msg$ = message$

if (split(msg$, part$(), ":|") > 2) then
	PartOne$=part$(1)
	PartTwo$ = part$(2)
	PartThree$ = part$(3)
fi

if (split(msg$, part$(), ":|") > 3) then
	PartFour$ = part$(4)
fi

if (msg$ <> "")  print msg$
switch msg$

//Cases

case "BT:Add|"
	exist= VIEW GET "BackgroundView","exists"
	if !exist then
	VIEW 0,0 TO 400,320, "BackgroundView","MainWindow"
	TABVIEW 5,2 TO 395,300, "Test", "top", "BackgroundView"
		TABVIEW ADD "Test",  "Tab1"
		TABVIEW ADD "Test",  "Tab2"
		
			
			BUTTON 5,5 TO 105,25, "BT:Hui", "Hui", "Test1"
		endif
		
	break

case "BT:Remove|"
	
	exist= VIEW GET "BackgroundView","exists"
	//tabview remove "Test",1
	if exist VIEW REMOVE "BackgroundView"
	
	
	
	
	break

case "MainWindow:_QuitRequested|"
	WINDOW CLOSE "MainWindow"
	break


default:

end switch

		
if(window count<1) inloop = false
sleep 0.1	
wend'

Discussions like this might fit better on http://yab.orgfree.com/forum/