This is something which has bugged me for a long time and has cropped up several times in discussions. In the past I have always dismissed this problem as not being particularly important, or at the least has not impacted my work at all... at least up to now.
It is to do with the way that PB handles the tab key in order to switch the focus between controls etc. PB would appear to set a keyboard accelerator for the tab key rather than process the IsDialogMessage_() function in its message loop. That is fair enough, until that is you turn to the Scintilla gadget!
Setting tabs within a Scintilla control has no effect (in that the tab key does not function) for a Scintilla control sitting within a window created by OpenWindow() etc. This is due in part because the Scintilla control does not swallow the tab key (perhaps because it does not process #WM_GETDLGCODE messages; I am unsure about this) and partly because PB sets the aforementioned keyboard accelerator.
Working around this requires removing the keyboard shortcut, which of course then stops us tabbing between controls! Catch 22.
You can see the problem with the following code which has removed the keyboard shortcut. Run without xp themes and click one of the buttons. Hitting the tab key will now not move the focus to the other button.
Code: Select all
If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) RemoveKeyboardShortcut(0, #PB_Shortcut_Tab) ButtonGadget(0, 10, 10, 200, 20, "Standard Button") ButtonGadget(1, 10, 40, 200, 20, "Standard Button") Repeat eventID = WaitWindowEvent() Select eventID EndSelect Until eventID = #PB_Event_CloseWindow EndIf
Code: Select all
hWnd = OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) If hWnd RemoveKeyboardShortcut(0, #PB_Shortcut_Tab) ButtonGadget(0, 10, 10, 200, 20, "Standard Button") ButtonGadget(1, 10, 40, 200, 20, "Standard Button") While GetMessage_(msg.MSG, #Null, 0, 0) If IsDialogMessage_(hWnd, msg) = 0 TranslateMessage_(msg) DispatchMessage_(msg) EndIf Wend EndIf
Fred/Freak, is there any chance that IsDialogMessage_() can be added to the PB event loop in favour of adding the keyboard accelerator etc? As I say this has just been a minor inconvenience up to now for me, up to my working with the Scintilla control that is! The program I am working on needs to be completely cross-platform and so I am unable to dip into the api here.