WinBlitz3d - Tabbers?
Blitz3D Forums/Blitz3D Beginners Area/WinBlitz3d - Tabbers?
| ||
| 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 ? |
| ||
| 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. |
| ||
| Thank you for the quick reply, i'll mess with it. |
| ||
| Hm, trying to figure out how to put text on it at the moment, any ideas? |
| ||
| Not only that but i cant seem to get the button working.. can someone give me a small example on how these work? |
| ||
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 |
| ||
| 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? |
| ||
| Hi Yahfree, i hope to have the finalised v1.1 available soon. still doing some more examples and docs. kev |
| ||
| 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. |
| ||
| 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 |
| ||
| how would i go about doing that? |
| ||
| Nevermind i got it to work! thanks! |
| ||
| 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? |
| ||
| 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. |
| ||
| 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 |
| ||
| 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? |
| ||
| I think sort of like this: |
| ||
| interesting.. |
| ||
| 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 |
| ||
| 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 |
| ||
| Seems to be working, thanks b32! |