Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to re-arrange child window tab order

Posted on 1998-12-02
2
Medium Priority
?
554 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

610 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