WinBlitz3d - Tabbers?

Blitz3D Forums/Blitz3D Beginners Area/WinBlitz3d - Tabbers?

Yahfree(Posted 2007) [#1]
Are tabbers possible in WinBlitz3d? i cant seem to find any documents on them: Tabbers are in the blitz3d IDE for ref. the things uptop you have the standard "Help" tabber and the project source files you have open tabbers


possible or ?


Danny(Posted 2007) [#2]
Yep you can... Use the Blitz3D_GUI_DLL.decls as a quick reference guide!

create a tabber gadget with WB3D_CreateTabber()
Then use WB3D_CreateTabberPanel() to create panels for each 'page' or 'tab' you have.

Note that you must 'manually' show & hide the panel(s) relative to what tab is chosen...

d.


Yahfree(Posted 2007) [#3]
Thank you for the quick reply, i'll mess with it.


Yahfree(Posted 2007) [#4]
Hm, trying to figure out how to put text on it at the moment, any ideas?


Yahfree(Posted 2007) [#5]
Not only that but i cant seem to get the button working.. can someone give me a small example on how these work?


Kev(Posted 2007) [#6]
here you go Yahfree. tabber panels are like any other parent, pass it as the parent for any gadget.

; WB3D styles
Include "WB3DStyles.bb"

Graphics3D 640,480,16,2
SetBuffer BackBuffer()

Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),10,10,500,500)

Dim tab_panels(4)
tabber = WB3D_CreateTabber(230,45,220,150,RuntimeWindow_hWnd,0)
For loop = 0 To 3
	WB3D_AddGadgetItem tabber,"Tab "+loop,0,0
	tab_panels(loop) = WB3D_CreateTabberPanel(0,30,WB3D_GadgetWidth(tabber)-30,WB3D_GadgetHeight(tabber)-40,tabber)
	WB3D_HideGadget tab_panels(loop)
Next

button_0 = WB3D_CreateButton("test button 0",40,40,100,20,tab_panels(0),0)
WB3D_ShowGadget tab_panels(0)

button_1 = WB3D_CreateButton("test button 1",60,10,100,20,tab_panels(1),0)
button_2 = WB3D_CreateButton("test button 2",20,20,100,20,tab_panels(2),0)
button_3 = WB3D_CreateButton("test button 3",40,60,100,20,tab_panels(3),0)

Global QUIT = 0
While QUIT = 0

Flip

	
	event = WB3D_WaitEvent()
	Select event
		
		Case WB3D_EVENT_GADGET	
			Select WB3D_EventSource()
				
				Case button_0
					WB3D_Notify "Hello","Button 0 event",0
					
				Case button_1
					WB3D_Notify "Hello","Button 1 event",0

				Case button_2
					WB3D_Notify "Hello","Button 2 event",0

				Case button_3
					WB3D_Notify "Hello","Button 3 event",0
				
				Case tabber 
					For loop = 0 To 3
						If loop = WB3D_EventData()
							WB3D_ShowGadget tab_panels(loop)
						Else
							WB3D_HideGadget tab_panels(loop)
						EndIf
					Next
					
			End Select
			
		Case WB3D_EVENT_WINDOW_CLOSE
			Select WB3D_EventSource()
				Case RuntimeWindow_hWnd
					QUIT = 1
					
			End Select
	End Select
		
Wend
WB3D_EndGUI()
WB3D_Notify "bye","were out of here!",0
End


kev


Yahfree(Posted 2007) [#7]
Ohh, thank you, make sense now, by the way, hows it going on the finalised version of Wb3d? and are you going to include the complete documents?


Kev(Posted 2007) [#8]
Hi Yahfree, i hope to have the finalised v1.1 available soon. still doing some more examples and docs.

kev


Yahfree(Posted 2007) [#9]
say kev, or anyone else, is there a way around this problem:

i have a array, that keeps track of how many tabs, then i have a veriable to stick in the array to tell it how many 'slots' or whatever they are called to make like so:
myslots=5
dim myarray(myslots)

now, i want to create a edit field for each 'slot' because this can varry i use a loop:

for loop=0 to myslots-1
myfield=WB3D_CreateEditField("",50,50,100,27,myarray(loop),num,0)
next


simple enough but! when i go to type on one it updates them all with the same words, because of the return 'gadget' veriable..

any work arounds? if i create them all seperately it doesnt work, because like i said before, the number of slots can varry, so i get that 'Array out of bounds' error sometimes.


Kev(Posted 2007) [#10]
use an array for myfield, your currently not creating more than one editfield but over writing the pointer each time a new one is created.

kev


Yahfree(Posted 2007) [#11]
how would i go about doing that?


Yahfree(Posted 2007) [#12]
Nevermind i got it to work! thanks!


Yahfree(Posted 2007) [#13]
Ok, now i'm trying to figure out how to 'Update' this text file,

for example, all i need to do is rewrite this line really:

myvalue=1000


to

myvalue=1500


how do i do that?

i tried this:

If FileType("mytext.txt")=1
file = OpenFile("mytext.txt")


While Not Eof(file)
c_line$ = ReadLine(file)

If c_line$="myvalue=1000" WriteLine(file,"myvalue=1500")

Wend
end if


Doesnt seem to work, what am i doing wrong here?


b32(Posted 2007) [#14]
Because the line you want to replace is allready read, the new line will be placed after it.
To avoid this, store FilePos(file) before using ReadLine. Then before using WriteLine use SeekFile file, oldpos
However, the new line should have the exact same length as the old line, else any following data will be overwritten.

The way around that is storing the entire file, say in a Type, then parse that data 'offline' and write it back to the file.


Yahfree(Posted 2007) [#15]
i'm trying to 'overwrite' the line with a new line, i'm not sure i understand what your saying, could you give me a small example?

thanks for your help b32


Yahfree(Posted 2007) [#16]
after messing with it some more, i got it to work, but i noticed the bug you mentioned, how do i store the entire file? and do that so it doesnt mess up like you mentioned?


b32(Posted 2007) [#17]
I think sort of like this:



Yahfree(Posted 2007) [#18]
interesting..


Yahfree(Posted 2007) [#19]
any idea why its giving me this error:

Expecting ')'

when i use this:
For editfile.filestorage = Each filestorage

If Left(editfile\lines$,8)="myvalue="
Mid(editfile\lines$,9,Len(editfile\lines$))="2000"
End If

Next

its giving that error on the "mid" line right after the first editfile\lines$ statement


b32(Posted 2007) [#20]
Ah, I think you cannot use Mid$ like that, it is read-only.
Instead, use left$:
editfile\lines$ = left$(editfile\lines$, 8) + "2000"

BTW, when using Mid$, you can omit the 3rd parameter, like this:
print Mid$(hello$, 8) --> will return everything from the 8th character


Yahfree(Posted 2007) [#21]
Seems to be working, thanks b32!