Normally, in MDI applications, it's possible to control+tab forward through tabs, and control+shift+tab backwards through them. You even see this in the PB IDE! However, the native MDIGadget doesn't seem to support this. Is it possible for me to implement it manually?
Thanks!
Allow control+tabbing between tabs of an MDIGadget()?
Re: Allow control+tabbing between tabs of an MDIGadget()?
Sorry Quin, no solution, but something strange I discovered:
I was tinkering with KeyboardShortcuts and the MDIGadget (which I used last time, boah... 15 years ago?) to see how things can be handled here.
Seems I found some hidden feature?
My MenuItem 11 of the Keyboardshortcut below leads to nothing, but if you press CTRL+TAB a window pops up asking to which MDI child you wanna go?!
That doesn't happen when there is no Keyboard shortcut, which is a little weird.
it doesn't happen also when I use:
MDIGadget(0, 0, 0, 0, 0, 0, 1, #PB_MDI_AutoSize)
I was tinkering with KeyboardShortcuts and the MDIGadget (which I used last time, boah... 15 years ago?) to see how things can be handled here.
Seems I found some hidden feature?
My MenuItem 11 of the Keyboardshortcut below leads to nothing, but if you press CTRL+TAB a window pops up asking to which MDI child you wanna go?!
That doesn't happen when there is no Keyboard shortcut, which is a little weird.
Code: Select all
If OpenWindow(0, 0, 0, 800, 600, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
If CreateMenu(0, WindowID(0))
MenuTitle("MDI windows menu")
MDIGadget(0, 0, 0, 0, 0, 0, 2, #PB_MDI_AutoSize)
AddGadgetItem(0, 1, "child1")
AddGadgetItem(0, 2, "child2")
AddGadgetItem(0, 3, "child3")
AddGadgetItem(0, 4, "child4")
UseGadgetList(WindowID(0))
AddKeyboardShortcut(0, #PB_Shortcut_Tab | #PB_Shortcut_Control, 11)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIfMDIGadget(0, 0, 0, 0, 0, 0, 1, #PB_MDI_AutoSize)
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{History Viewer Online}.:|:.{Send a Beer}
Re: Allow control+tabbing between tabs of an MDIGadget()?
this works
edit both ways
Code: Select all
Procedure MDIChild()
Protected child
Select EventMenu()
Case 0
child = GetGadgetState(0) + 1
If child > 4
child = 1
EndIf
Case 1
child = GetGadgetState(0) - 1
If child < 1
child = 4
EndIf
EndSelect
SetGadgetState(0,child)
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
If CreateMenu(0, WindowID(0))
MenuTitle("MDI windows menu")
MDIGadget(0, 0, 0, 0, 0, 0, 2, #PB_MDI_AutoSize)
BindMenuEvent(0,0,@MDIChild())
BindMenuEvent(0,1,@MDIChild())
AddGadgetItem(0, 1, "child1")
AddGadgetItem(0, 2, "child2")
AddGadgetItem(0, 3, "child3")
AddGadgetItem(0, 4, "child4")
UseGadgetList(WindowID(0))
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_Tab, 0)
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_Tab, 1)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Allow control+tabbing between tabs of an MDIGadget()?
I came up with this:

How does the logic in your procedure work? I.e. what are those calculations?
Code: Select all
Procedure MenuEvents()
Select EventMenu()
Case 0
SetGadgetState(0, #PB_MDI_Next)
Case 1
SetGadgetState(0, #PB_MDI_Previous)
EndSelect
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
If CreateMenu(0, WindowID(0))
MenuTitle("MDI windows menu")
MDIGadget(0, 0, 0, 0, 0, 0, 2, #PB_MDI_AutoSize)
AddGadgetItem(0, 1, "child1")
AddGadgetItem(0, 2, "child2")
AddGadgetItem(0, 3, "child3")
AddGadgetItem(0, 4, "child4")
UseGadgetList(WindowID(0))
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_Tab, 0)
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_Shift | #PB_Shortcut_Tab, 1)
BindEvent(#PB_Event_Menu, @MenuEvents())
EndIf
Repeat : Until WaitWindowEvent(1) = #PB_Event_CloseWindow
EndIf
How does the logic in your procedure work? I.e. what are those calculations?
Re: Allow control+tabbing between tabs of an MDIGadget()?
I guess it helps to read the manual.
I've never used the MDI gadget in PB so I didn't have a clue and didn't notice #PB_MDI_NEXT
I was using % mod operator so it would wrap around
I've never used the MDI gadget in PB so I didn't have a clue and didn't notice #PB_MDI_NEXT
I was using % mod operator so it would wrap around
Re: Allow control+tabbing between tabs of an MDIGadget()?
I haven't used the MDI gadget too. Quite strange behavior with #PB_MDI_Next and #PB_MDI_Previous!
Here with Quin's example, it rolls or unrolls in the opposite direction
With Ctrl+Tab (#PB_MDI_Next): child4 -> child3 -> 2 -> 1 -> 4
And with Ctrl+Shift+Tab (#PB_MDI_Previous): child1 -> child2 -> 3 -> 4 -> 1
it's all good with idle's code snippet, It wraps in the right order.
Do you have an explanation?
Here with Quin's example, it rolls or unrolls in the opposite direction
With Ctrl+Tab (#PB_MDI_Next): child4 -> child3 -> 2 -> 1 -> 4
And with Ctrl+Shift+Tab (#PB_MDI_Previous): child1 -> child2 -> 3 -> 4 -> 1
it's all good with idle's code snippet, It wraps in the right order.
Do you have an explanation?

