Tab Traversal doesn't work on wxPanel with wxButton controls on macOS

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Sridhar@Work
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 221
Joined: Fri Jan 08, 2021 8:19 am

Tab Traversal doesn't work on wxPanel with wxButton controls on macOS

Post by Sridhar@Work »

We are using wxDialog to show the model dialog. We used the following layout for the dialog:

Code: Select all

wxFlexGridSizer -->
      panel-1 (wxTAB_TRAVERSAL flag is not set)
	    wxFlexGridSizer
		   image
	  panel-2  (wxTAB_TRAVERSAL flag is set)
	    wxFlexGridSizer
		    wxFlexGridSizer
			    wxBoxSizer
				   label control
				wxBoxSizer
				   textbox control
            wxFlexGridSizer
			    wxBoxSizer
				   label control
				wxBoxSizer
				   textbox control				   
		    wxFlexGridSizer
			    wxBoxSizer
				   label control
				wxBoxSizer
				   textbox control
            wxFlexGridSizer
			    wxBoxSizer
				   label control
				wxBoxSizer
				   textbox control				   
	  panel-3  (wxTAB_TRAVERSAL flag is set)
	     wxFlexGridSizer
		    wxFlexGridSizer
			    wxBoxSizer
				   button
            wxFlexGridSizer
			    wxBoxSizer
				   button
            wxFlexGridSizer
			    wxBoxSizer
				   button
On macOS when I press tab, the focus doesn't get to "Cancel/Ok" buttons? The same code works fine on Linux(gtk3) and Windows.

Is there anything extra we have to do to set focus on the panel-3 for the focus to return on the button controls?

Regards
Sree
Sridhar@Work
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 221
Joined: Fri Jan 08, 2021 8:19 am

Re: Tab Traversal doesn't work on wxPanel with wxButton controls on macOS

Post by Sridhar@Work »

On macOS, when I changed the system preferences->keyboard->shortcuts->Full keyboard access: In Windows and dialogs, press Tab to move keyboard focus between->All Controls instead of "Textboxes and lists only", then the key board focus is shown on both textbox controls and buttons also.

So it is not issue with wxWidgets controls. Hope the above information will be helpful for others

Regards
Sree
Post Reply