Page 1 of 1

How do I make the Enter key behave as a Tab key

Posted: Wed Oct 12, 2011 1:13 pm
by thierry94
Hi,

How do I make the Enter key behave as a Tab key in all gadgets ?


Thanks.

Re: How do I make the Enter key behave as a Tab key

Posted: Wed Oct 12, 2011 4:41 pm
by IdeasVacuum
Well, if they are a similar size and shape, you can easily swap them over on your keyboard............

Could it be that you want the focus to move to the next (string) Gadget when the Enter Key is hit in the current one? If so, detect the Enter Key, then use SetActiveGadget(#Gadget).

Add a short cut to the Procedure that defines your app window:

Code: Select all

AddKeyboardShortcut(#MyWindow,#VK_RETURN,#KeyEnter)
If this is just for your own use of course it's absolutely fine, but others might find the behaviour to be unexpected.

Edit: I do not know if the above short cut code would work in Linux, #VK_RETURN is definitely Windows and needs to be replaced by the Linux equivalent (if it exists).

Re: How do I make the Enter key behave as a Tab key

Posted: Wed Oct 12, 2011 5:33 pm
by thierry94
hi

But how know the next gadget to activate, the window contain 100 gadgets.
I think we should use the APIs to retrieve the list of gadgets in the container, and find the gadget activated and activate the following.
or
trap key enter et send key tab

Re: How do I make the Enter key behave as a Tab key

Posted: Wed Oct 12, 2011 7:19 pm
by IdeasVacuum
........Simply number the gadgets in the sequence that you feel is most appropriate, then you always know the next gadget since it is the current gadget ID + 1.

Re: How do I make the Enter key behave as a Tab key

Posted: Wed Oct 26, 2011 9:59 am
by thierry94
For information

gtk_widget_child_focus_(gtk_widget_get_toplevel_(GadgetID(GetActiveGadget())), #GTK_DIR_TAB_FORWARD)