PureBasic Forum
https://www.purebasic.fr/english/

[Done] 5.73b3 TAB key in editor gadget with new msftedit.dll
https://www.purebasic.fr/english/viewtopic.php?f=4&t=76232
Page 1 of 1

Author:  horst [ Fri Nov 06, 2020 10:49 am ]
Post subject:  [Done] 5.73b3 TAB key in editor gadget with new msftedit.dll

The TAB key can no longer be used to jump to the next TAB stop in the editor gadget.
With Ctrl+TAB this works. (To test see snippet viewtopic.php?f=4&t=76204 )

Are there any hidden settings?
Can it be fixed, or has this changed for good (then I'll have to take care of it)

Author:  Little John [ Sun Nov 08, 2020 10:01 am ]
Post subject:  Re: 5.73b3 TAB key in editor gadget with new msftedit.dll

I've created another small code snippet for testing. It contains two button gadgets in addition to the editor gadget:
Code:
#WinWidth  = 400
#WinHeight = 300
#BtnY = #WinHeight-50

Define.i edit, ok, cancel, event

If OpenWindow(0, 100, 100, #WinWidth, #WinHeight, "Editor Gadget Test") = 0
   MessageRequester("Fatal error",
                    ~"Can't open main window.\nProgram terminated.")
   End
EndIf

edit   = EditorGadget(#PB_Any, 10, 10, #WinWidth-20, #WinHeight-80)
ok     = ButtonGadget(#PB_Any, 220, #BtnY, 60, 30, "OK")
cancel = ButtonGadget(#PB_Any, 310, #BtnY, 80, 30, "Cancel")
SetActiveGadget(ok)

Repeat
   event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow

I did all tests on Windows 10.
Initially, the keyboard focus is on the OK button (although not visible here). After pressing the TAB key twice, the focus is in the editor gadget.
When I then press the TAB key again, different things happen, depending on the used PB version:
  • With PB 5.72 LTS, tab characters are inserted in the editor gadget. It's not possible to set the focus to another gadget by pressing the TAB key.
    You can find code here on the forum, that works around this issue, e.g. by using PB's AddKeyboardShortcut() or a Windows callback.
  • With PB 5.73 beta 3, the focus changes to the OK button. In other words, we now can always use the TAB key for setting the focus to another gadget, regardless on which gadget the focus currently is. (This is at least true for this small example -- I didn't test all PureBasic gadgets.) As you wrote, tab characters can still be inserted in the editor gadget by pressing [Ctrl]+[Tab].

Personally, I prefer the new behaviour, and I can imagine that the change might have been done deliberately (for the reason I mentioned).

Author:  horst [ Sun Nov 08, 2020 2:21 pm ]
Post subject:  Re: 5.73b3 TAB key in editor gadget with new msftedit.dll

Little John wrote:
Personally, I prefer the new behaviour, and I can imagine that the change might have been done deliberately (for the reason I mentioned).

I agree (though I'll have to modify my programs).

@Fred:
If there are no objections from your side, this thread can be stamped [done]

Author:  Little John [ Sun Nov 08, 2020 7:57 pm ]
Post subject:  Re: 5.73b3 TAB key in editor gadget with new msftedit.dll

horst wrote:
(though I'll have to modify my programs)

For this reason, IMHO this change should be documented clearly in the help.

Author:  Fred [ Mon Nov 09, 2020 11:08 am ]
Post subject:  Re: 5.73b3 TAB key in editor gadget with new msftedit.dll

I don't know which is better. Having tab working in an EditorGadget() looks correct to me. I will take a look to how re-enable this.

Author:  Fred [ Mon Nov 09, 2020 11:31 am ]
Post subject:  Re: 5.73b3 TAB key in editor gadget with new msftedit.dll

Fixed.

Author:  Little John [ Tue Nov 10, 2020 2:32 am ]
Post subject:  Re: 5.73b3 TAB key in editor gadget with new msftedit.dll

Fred wrote:
Having tab working in an EditorGadget() looks correct to me. I will take a look to how re-enable this.

If the keyboard focus is in the EditorGadget, how can the user than change the focus to another gadget with the keybord?

Users should be able to move between controls using the TAB key and SHIFT+TAB.

Author:  kenmo [ Tue Nov 10, 2020 5:06 am ]
Post subject:  Re: [Done] 5.73b3 TAB key in editor gadget with new msftedit

Is this something that could be made optional by a gadget flag? #PB_Editor_TabFocus or something

Author:  horst [ Tue Nov 10, 2020 9:14 am ]
Post subject:  Re: [Done] 5.73b3 TAB key in editor gadget with new msftedit

With PB 5.73b3 I can catch the TAB key (including the editor gadget) by AddKeyboardShortcut(),
which was not possible on previous versions, where I had to use a #GWL_WNDPROC construct.

A mode toggle as suggested by kenmo would be all right, but in any case I would appreciate the support for AddKeyboardShortcut().

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/