Code: Select all
EnableExplicit
;- Global
Global.i Window_0
Global.i Combo_1
Global.i Combo_2
Global.i Combo_3
Global.i Combo_4
Global.i WW, EW, EM, EG, ET, AG ;<<--- WW= WaitWindowEvent() EW= EventWindow() EM= EventMenu() EG= EventGadget() ET= EventType() AG= GetActiveGadget()
;========================================================
;-[ Keyboard Shortcut Constants ]
;========================================================
#KeyReturn=10013 : #KeyEscape=10027 : #KeyPageUp=10033 : #KeyPageDown=10034 : #KeyEnd=10035 : #KeyHome=10036 : #KeyUp=10038 : #KeyDown=10040
;- Declare
Declare Open_Window_0(X = 0, Y = 0, Width = 1160, Height = 764)
Procedure Open_Window_0(X = 0, Y = 0, Width = 1160, Height = 764)
Window_0 = OpenWindow(#PB_Any, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
;=====================================================================
;- Add Keyboard Shortcuts to travel thru Inputs
;=====================================================================
AddKeyboardShortcut(Window_0,#PB_Shortcut_Return,#KeyReturn)
AddKeyboardShortcut(Window_0,#PB_Shortcut_Escape,#KeyEscape)
AddKeyboardShortcut(Window_0,#PB_Shortcut_PageDown,#KeyPageDown)
AddKeyboardShortcut(Window_0,#PB_Shortcut_PageUp,#KeyPageUp)
AddKeyboardShortcut(Window_0,#PB_Shortcut_Tab,#KeyReturn)
AddKeyboardShortcut(Window_0,#PB_Shortcut_Tab | #PB_Shortcut_Shift,#KeyEscape)
Combo_1 = ComboBoxGadget(#PB_Any, 128, 89, 144, 29)
AddGadgetItem(Combo_1, -1, "Combo_1")
SetGadgetState(Combo_1, 0)
SetGadgetData(Combo_1,1)
Combo_4 = ComboBoxGadget(#PB_Any, 133, 247, 137, 31)
AddGadgetItem(Combo_4, -1, "Combo_4")
SetGadgetState(Combo_4, 0)
SetGadgetData(Combo_4,4)
Combo_2 = ComboBoxGadget(#PB_Any, 129, 147, 141, 27)
AddGadgetItem(Combo_2, -1, "Combo_2")
SetGadgetState(Combo_2, 0)
SetGadgetData(Combo_2,2)
Combo_3 = ComboBoxGadget(#PB_Any, 128, 198, 145, 27)
AddGadgetItem(Combo_3, -1, "Combo_3")
SetGadgetState(Combo_3, 0)
SetGadgetData(Combo_3,3)
SetActiveGadget(Combo_1)
EndProcedure
;- Main Program
Open_Window_0()
;- Event Loop
Repeat
WW = WaitWindowEvent(10) ;<<--- Wait until a new Window or Gadget Event occurs. ( 10 = the timeout in milliseconds or 1000 milliseconds = 1 second )
EW = EventWindow() ;<<--- In Programs with more than one Form or Window, which Window did the Event occur on
EM = EventMenu() ;<<--- Which Menu did the Event occur on
EG = EventGadget() ;<<--- Which Gadget did the Event occur on ( #PB_Any Number , a Numerical Number , or Constant #Name of the Gadget )
ET = EventType() ;<<--- What sort of Event Type occurred
AG = GetActiveGadget() ;<<--- Get the Active Gadget's Numerical Number or Constant #Name that has the current Focus
Select WW
Case #PB_Event_Menu
Select EM
Case #KeyPageDown, #KeyReturn
Select GetGadgetData(AG)
Case 1 : SetActiveGadget(Combo_2)
Case 2 : SetActiveGadget(Combo_3)
Case 3 : SetActiveGadget(Combo_4)
Case 4 : SetActiveGadget(Combo_1)
EndSelect
Case #KeyPageUp, #KeyEscape
Select GetGadgetData(AG)
Case 1 : SetActiveGadget(Combo_4)
Case 2 : SetActiveGadget(Combo_1)
Case 3 : SetActiveGadget(Combo_2)
Case 4 : SetActiveGadget(Combo_3)
EndSelect
EndSelect
EndSelect
Until WW = #PB_Event_CloseWindow : End