Solved

How to re-arrange child window tab order

Posted on 1998-12-02
2
552 Views
Last Modified: 2013-12-03
A window or dialog that contains child controls allow you jump between the child controls by using the <Tab> key.

As I understand it, the order in which the child controls are visited is determined by the creation order of the child controls.

My question is, how can I at runtime (i.e. after the child windows are created) change the tab order of the controls?

Thanks in advance,
AndersWP
0
Comment
Question by:AndersWP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
stsanz earned 100 total points
ID: 1416620
The controls tab order in a dialog box is similar to the windows z-order. The control that is the first in tab order will have the higher z-order.
So you can use SetWindowPos to change controls tab order.

For example, if you call :
SetWindowPos(GetDlgItem(hDlg,IDOK),GetDlgItem(hDlg,IDCANCEL),SWP_NOMOVE|SWP_NOSIZE)) ;

this will cause the IDOK button to be placed after the IDCANCEL button in tab order.

To set all controls tab order, use :
SetWindowPos(GetDlgItem(hDlg,ID_xx1),HWND_BOTTOM,SWP_NOMOVE|SWP_NOSIZE)) ;
SetWindowPos(GetDlgItem(hDlg,ID_xx2),HWND_BOTTOM,SWP_NOMOVE|SWP_NOSIZE)) ;
SetWindowPos(GetDlgItem(hDlg,ID_xx3),HWND_BOTTOM,SWP_NOMOVE|SWP_NOSIZE)) ;
.

for each control in the order you want the controls to be tab ordered.

Hope this helps.

0
 
LVL 1

Author Comment

by:AndersWP
ID: 1416621
Thanks stsanz - that did indeed do the trick. I was aware of the SetWindowPos function and Z-order, but I thought it only applied to the visual appearance of the windows, not the tab order.

Regards,
AndersWP
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question