ChrisR wrote: Fri Apr 05, 2024 2:23 pm Yes, yes, I understand the need for the Tab Order, I've made a note of it in my Todo.
I haven't really thought yet about how to do it, how to present it... I'll take a look but I'll let it mature, no rush, slowly, slowly![]()
For now, it's pretty easy to do it with a macro and SetWindowPos() Api, ex:
Code: Select all
EnableExplicit Enumeration Window #Window_0 EndEnumeration Enumeration Gadgets #Txt_1 #String_1 #Btn_OK #Txt_2 #String_2 #Txt_3 #String_3 EndEnumeration Macro SetTabOrder(_Gadget_) SetWindowPos_(GadgetID(_Gadget_), #HWND_BOTTOM, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE) EndMacro Procedure Open_Window_0(X = 0, Y = 0, Width = 300, Height = 140) If OpenWindow(#Window_0, X, Y, Width, Height, "Tab order", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered) TextGadget(#Txt_1, 20, 22, 60, 22, "Text_1") StringGadget(#String_1, 80, 20, 120, 24, "String_1") ButtonGadget(#Btn_OK, 220, 24, 60, 96, "OK") TextGadget(#Txt_2, 20, 62, 60, 22, "Text_2") StringGadget(#String_2, 80, 60, 120, 24, "String_2") TextGadget(#Txt_3, 20, 102, 60, 22, "Text_3") StringGadget(#String_3, 80, 100, 120, 24, "String_3") ; Comment/uncomment to use the Gadget creation order or the one defined below SetTabOrder(#String_1) : SetTabOrder(#String_2) : SetTabOrder(#String_3) : SetTabOrder(#Btn_OK) SetActiveGadget(#String_1) ProcedureReturn #True EndIf EndProcedure If Open_Window_0() Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf
ChrisR , i don't know how difficult this would be to use in your Designer ???
Travel thru Gadgets ( example 5)
Code: Select all
EnableExplicit
;- Global
Global.i Window_0
Global.i WW, EW, EM, EG, ET, AG ;<<--- WW= WaitWindowEvent() EW= EventWindow() EM= EventMenu() EG= EventGadget() ET= EventType() AG= GetActiveGadget()
Global.i Gad = 10 ;<<--- Gad = Array contains the total number of User input Gadgets , such as : StringGadgets and ComboBoxGadgets in GUI
Global.i Dim G(Gad) ;<<--- G(Gad) Gadget's numerical numbering system using #PB_Any, SetGadgetData, and GetGadgetData for all User Inputs and Choices
;========================================================
;-[ 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)
G(1) = StringGadget(#PB_Any, 128, 89, 144, 29,"String_1")
SetGadgetData(G(1),1)
G(4) = ComboBoxGadget(#PB_Any, 133, 247, 137, 31) ;<<--- 4 is out of desired Gadget TAB Order
AddGadgetItem(G(4), -1, "Combo_4")
SetGadgetState(G(4), 0)
SetGadgetData(G(4),4)
G(2) = ComboBoxGadget(#PB_Any, 129, 147, 141, 27)
AddGadgetItem(G(2), -1, "Combo_2")
SetGadgetState(G(2), 0)
SetGadgetData(G(2),2)
G(3) = ComboBoxGadget(#PB_Any, 128, 198, 145, 27)
AddGadgetItem(G(3), -1, "Combo_3")
SetGadgetState(G(3), 0)
SetGadgetData(G(3),3)
SetActiveGadget(G(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 To 3 : SetActiveGadget(G(GetGadgetData(AG) + 1))
Case 4 : SetActiveGadget(G(1))
EndSelect
Case #KeyPageUp, #KeyEscape
Select GetGadgetData(AG)
Case 1 : SetActiveGadget(G(4))
Case 2 To 4 : SetActiveGadget(G(GetGadgetData(AG) - 1))
EndSelect
EndSelect
EndSelect
Until WW = #PB_Event_CloseWindow : End