Tab Traversal Issues

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nightfire8199
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Jul 18, 2017 1:47 pm

Tab Traversal Issues

Post by nightfire8199 »

Hey guys, new to wxWidgets and encountering an odd problem.

I have a Panel with a series of sizers within it, and within them a series of controls. wxTAB_TRAVERSAL is set as the window style on the Panel. When I attempt to use the tab traversal in my running application it consistently tabs forward two controls (every other one). Meaning, if I start with focus on the first control, it will tab to the third. If I start with focus on the second, it will move focus to the third.

I'm certain this is a trivial problem to solve, but I'm too new to be able to know where I should be looking. Is there any place you guys can think of where this behavior might be being introduced?
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Tab Traversal Issues

Post by doublemax »

What type of controls are they? Can you post the code that generates the controls?

Check that the parent of the controls is correct.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tab Traversal Issues

Post by ONEEYEMAN »

Hi,
How did you create the controls?
Make sure you create them in the same sequence as you want them to appear in the tab order.

Thank you.
nightfire8199
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Jul 18, 2017 1:47 pm

Re: Tab Traversal Issues

Post by nightfire8199 »

It is a series of combo boxes, they seem to be in the right order. I named them alphabetically just to be sure

The odd part is that it isn't just visiting them in the wrong order, it is always skipping every other control. Due to the number of controls I have, this means that if I start on an even numbered positioned control, it will never land on an odd placement one. It just continuously cycles across the evens. The same is true if I start on an odd placed one, it never hits an even. I'm not sure what is causing it to always move forward two controls in the tab order. :?

...Here is the code:

Code: Select all

wxGridSizer* gSizer8;
gSizer8 = new wxGridSizer( 0, 3, 0, 0 );
	
m_comboBox_A = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_XVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_B = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_YVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_C = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_ZVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_D = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_RVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_E = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_PVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_F = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_QVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_G = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_XScaleVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_H = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_YScaleVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_I = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_ZScaleVar, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_J = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_XLength, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_K= new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_YLength, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_L = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_ZLength, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_M = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_XRefLength, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_N = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_YRefLength, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_O = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_ZRefLength, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_P = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_Red, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_Q = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_Green, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_R = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_Blue, 0, wxALL|wxEXPAND, 5 );
	
m_comboBox_S = new wxComboBox( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); 
gSizer8->Add( m_comboBox_Alpha, 0, wxALL|wxEXPAND, 5 );
Last edited by nightfire8199 on Tue Jul 18, 2017 6:01 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Tab Traversal Issues

Post by doublemax »

You're using "sbSizer1->GetStaticBox()" as parent everywhere, but you're putting the controls into "gSizer8". One of them must be wrong.
Use the source, Luke!
Post Reply