Solved

How to re-arrange child window tab order

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

19 Experts available now in Live!

Get 1:1 Help Now