Jumping using Tab key across different group boxes

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
triangulum
Earned a small fee
Earned a small fee
Posts: 13
Joined: Mon Jun 04, 2007 8:17 am

Jumping using Tab key across different group boxes

Post by triangulum »

HI all,

the GUI has several group boxes, and different controls within these.

Switching between controls via Tab key is no problem within any GroupBox.

However, it is desired that after the last GUI in one group box, the first in the next[/b] GroupBox shall gain focus.

Any ideas?
wxUnfaehig
Earned a small fee
Earned a small fee
Posts: 22
Joined: Fri Nov 22, 2013 8:34 am

Re: Jumping using Tab key across different group boxes

Post by wxUnfaehig »

this a problem for me as well .. any ideas?
jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: Jumping using Tab key across different group boxes

Post by jgrzybowski »

You can try to define your own popupmenu function and set up entry for key code WXK_TAB:

Code: Select all

wxAcceleratorEntry entries[1]; //where [1] mens number of wxKeyEvents for different key codes you are going to define
entries[0].Set(wxACCEL_NORMAL, WXK_TAB, ID_NUMBER_FROM_YOUR_POPUPMENU); //now using TAB will run your popup menu function
wxAcceleratorTable accel(1, entries);
SetAcceleratorTable(accel); 
Inside of your popupmenu function you can control focus:

Code: Select all

wxWindow *SelectedGUI = wxWindow::FindFocus();
int IdOfSelectedGUI = SelectedGUI->GetId();
if(IdOfSelectedGUI == ID_OF_SOME_GUI){ //depends what is selected GUI
	NameOfNextGUI->SetFocus(); //will be set up focus for next GUI
}else{ //... and for all GUI elements
Regards
Jarek
Post Reply