Solved

How to re-arrange child window tab order

Posted on 1998-12-02
2
547 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

816 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now