Page 1 of 1
updateing stuff on the screen?
Posted: Tue Nov 03, 2009 6:26 am
by John-G
I have Opened a window and i put a auto build number on it i am using this but i dont like it
TextGadget(#Text_8, 275, 45, 200, 12, "Version 2009 Build # 0.0.:" + Str(#PB_Compiler_Date), #PB_Text_Center)
and
I made a Panelgadget and added tabs to it .. if there is something that comes up in another tab is there a way to switch to it to make the tab on top
and last. I would like to make a LED (like) botton of something that i would like to show on then off ( like a switch) any thoughts? would i use a "bottonimagegadget" ?
Re: updateing stuff on the screen?
Posted: Wed Nov 04, 2009 5:12 am
by WilliamL
I liked your LED idea and I've been playing with making one...
This is how far I got before I ran out of time to work on it.
Code: Select all
Enumeration
#ledon
#ledoff
EndEnumeration
#ledwnd=1
#ledbutton=1
#red=$0000FF
#black=0
#white=$FFFFFF
ledsize=10
If CreateImage(#ledon, ledsize, ledsize)
StartDrawing(ImageOutput(#ledon))
Box(0,0,ledsize,ledsize,#white) ; background
Circle(ledsize/2,ledsize/2,ledsize/2-1,#red)
DrawingMode(#PB_2DDrawing_Outlined)
Circle(ledsize/2,ledsize/2,ledsize/2-1,#black) ; black line around red
StopDrawing()
EndIf
If CreateImage(#ledoff, ledsize, ledsize)
StartDrawing(ImageOutput(#ledoff))
Box(0,0,ledsize,ledsize,#white) ; background
Circle(ledsize/2,ledsize/2,ledsize/2-1,#black)
StopDrawing()
EndIf
If OpenWindow(#ledwnd, 100, 100, 500, 300, "Led on and off")
SetWindowColor(#ledwnd,#white)
ImageGadget(#ledbutton,5,5,ledsize,ledsize,ImageID(#ledoff))
Repeat
event=WaitWindowEvent()
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case #ledbutton
toggle=1-toggle
If toggle
SetGadgetState(#ledbutton,ImageID(#ledon))
Else
SetGadgetState(#ledbutton,ImageID(#ledoff))
EndIf
EndSelect
EndSelect
Until event = #PB_Event_CloseWindow
EndIf
Image background should be the same color as the window background (white in this code). Toggle value could be stored in SetGadgetData(#ledbutton,togglevalue) if you didn't want to create a global variable.
I made a Panelgadget and added tabs to it .. if there is something that comes up in another tab is there a way to switch to it to make the tab on top
Code: Select all
SetGadgetState(#panelgadget,numberoftab)