In a dialog, there are three controls: A, B, and C, the tab stop order is
A -> B -> C, it is set in the design time. My question is how to change this
order when the program is running, like change to A -> C -> B.
Thanks in advance
Vincent
You can do it with the SetWindowPos() function.
--
Bjarne Nielsen
But this will not change the Tab order for a program that is already
running.
I am not aware of any way to change tab Order once the program has been
compiled.
-Mark
Yes, SetWindowPos can change the tab order of dialog box controls while the
program is running.
--
Jeff Partch [VC++ MVP]
It would be something like this
A.SetWindowPos(&wndTop,....,SWP_NOSIZE|SWP_NOMOVE);
C.SetWindowPos(&A,....,SWP_NOSIZE|SWP_NOMOVE);
B.SetWindowPos(&B,....,SWP_NOSIZE|SWP_NOMOVE);
Ali R.
Well, actually it would be
A.SetWindowPos(&wndTop,....,SWP_NOSIZE|SWP_NOMOVE);
C.SetWindowPos(&A,....,SWP_NOSIZE|SWP_NOMOVE);
B.SetWindowPos(&C,....,SWP_NOSIZE|SWP_NOMOVE);
just to be pedantic :-)
--
Bjarne Nielsen
See, this is how you end up with bugs :) thanks Bjarne
Ali R.
Rail
--
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro
mailto:rai...@earthlink.net
Thanks for posting in the group.
Based on your description, the question is: How to change control's tab
order in a dialog in runtime?
A lot of community member has give your the right answer. Yes, to change
the tab order at run time you would need to call the SetWindowPos API.
Generally speaking, Microsoft Windows maintains all the windows in the
system in a list. It uses this list for purposes like painting the windows,
maintaining the z order, and so on. The order in which the child controls
(in a dialog) are created determines their position in the list and, hence,
the tabbing order. By changing the position of the windows in this list, we
can change the tabbing order. Change the window list order by calling
SetWindowPos and passing the relevant windows handles in the first
parameter (handle of the window to insert in order) and the second
parameter (handle of the window to insert after). The window handle
specified in the first parameter would come after the second in the tab
order.
If there is anything unclear, please feel free to post here. :)
Have a good day.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.