Hi,
I need to automatically select the next panel when someone presses tab in the last string gadget of the previous panel. Is this possible?
Tab to next panel
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Yes it is....
Code: Select all
;-Window Constants
Enumeration 1
#Window_Form1
EndEnumeration
#WindowIndex=#PB_Compiler_EnumerationValue
;-Gadget Constants
Enumeration 1
;Window_Form1
#Gadget_Form1_Panel2
#Gadget_Form1_Panel2Tab3
#Gadget_Form1_Panel2Tab4
#Gadget_Form1_String1
#Gadget_Form1_String2
#Gadget_Form1_String3
EndEnumeration
#GadgetIndex=#PB_Compiler_EnumerationValue
Procedure.l Window_Form1()
If OpenWindow(#Window_Form1,169,179,220,179,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Work Form1")
If CreateGadgetList(WindowID(#Window_Form1))
PanelGadget(#Gadget_Form1_Panel2,10,10,200,150)
AddGadgetItem(#Gadget_Form1_Panel2,-1,"Tab3")
StringGadget(#Gadget_Form1_String1,15,10,80,20,"")
StringGadget(#Gadget_Form1_String2,15,40,80,20,"")
AddGadgetItem(#Gadget_Form1_Panel2,-1,"Tab4")
StringGadget(#Gadget_Form1_String3,15,10,80,20,"")
CloseGadgetList()
HideWindow(#Window_Form1,0)
ProcedureReturn WindowID()
EndIf
EndIf
EndProcedure
;-Main Loop
If Window_Form1()
quitForm1=0
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
If EventWindowID()=#Window_Form1
quitForm1=1
EndIf
Case #PB_Event_Gadget
Select EventGadgetID()
Case #Gadget_Form1_String1
Case #Gadget_Form1_String2
If EventType()=#PB_EventType_LostFocus ; String gadget lost focus
SetGadgetState(#Gadget_Form1_Panel2,1)
EndIf
EndSelect
EndSelect
Until quitForm1
CloseWindow(#Window_Form1)
EndIf
End
-
- User
- Posts: 27
- Joined: Sat Oct 16, 2004 1:25 pm
I also had to do this for a combo box gadget and your excellent code put me on the right track. If you need to change to the next panel if a combo box gadget loses focus just substitute
If EventType()=#PB_EventType_LostFocus
with
If GetFocus_() <> GetWindow_(GadgetID(#Name of gadget), #GW_CHILD)
Thanks a lot Num3.
If EventType()=#PB_EventType_LostFocus
with
If GetFocus_() <> GetWindow_(GadgetID(#Name of gadget), #GW_CHILD)
Thanks a lot Num3.
-
- User
- Posts: 27
- Joined: Sat Oct 16, 2004 1:25 pm