?
Solved

How to re-arrange child window tab order

Posted on 1998-12-02
2
Medium Priority
?
553 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 300 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

762 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