From: Woody on
On Mar 20, 6:39 am, ThoK <ThoKKrege...(a)aol.com> wrote:
> I am still working with Visual C++ 6.0. My dialog-based program does
> not follow the tab-sequence which I define for my controls. In fact
> the tab-sequence is the sequence in which I installed them.

Here is what I suggest. These steps have always worked for me in VS6.

1) Be sure all the controls you want to TAB to have the Tab stop
property set. Do this by right-clicking the control in the dialog
editor and look on the General tab.
2) Explicitly set the order you want by selecting Tab Order from the
Layout menu (or use the short-cut Ctrl-D). When you do this, you will
see the current tab order. You can just ignore that, and click on the
controls for the tab order you want. When you have finished setting
the order you want, type Enter to save the new order, and recompile.
3) If you have any "grouped" controls, such as a set of radio buttons,
you will also want to set the Group property on the first one of the
set, and the first one following that is NOT in the set.

From: ThoK on
Hi community,

thank you for the multitude of answers. Although I define the tab-
sequence in the way that you describe and the "tab stop property" is
set to the controls (thank you, Woody), in this specific project the
tab-order remains as it is.

I created a test-project where I tested to define the tab order
reverse to the sequence in which I inserted the controls - works! In
my other projects I can also define the tab order by Ctrl D. But it
does not work in this program. Can it be that a special command
prevents the dialog from keeping the defined tab order?

Might be, I have to rewrite the program. As I have the code already,
this is not too laborious.

> There's a facility in the dialog editor that lets you edit the tab
> order. I can't remember what it's called in VC6, but it may respond to
> the Ctrl+T accelerator.
>
> Dave
From: David Lowndes on
>I created a test-project where I tested to define the tab order
>reverse to the sequence in which I inserted the controls - works! In
>my other projects I can also define the tab order by Ctrl D. But it
>does not work in this program.

Then you must have some code in that project that's giving rise to the
problem.

I suggest that you start commenting out some of the handlers of the
offending dialog until you get the tab ordering working as it is
defined.

Dave
From: Woody on
On Mar 21, 3:16 am, ThoK <ThoKKrege...(a)aol.com> wrote:
> Can it be that a special command
> prevents the dialog from keeping the defined tab order?

Let me make two more suggestions. First, as was mentioned by others,
the tab order is the order the controls appear in the resource file,
YourProjectName.rc. This is a text file, which you can view with a
text editor or with VS6. To open it in VS6, just use the file open,
and select Text instead of Auto for Open as. In the resource file, you
can verify that you have stored the order you want, and set the
appropriate tab stop and group properties. Here is an excerpt from
an .rc file. All your dialogs will be in the same file, so you will
have to locate the correct dialog.

BEGIN
DEFPUSHBUTTON "STORE",IDOK,518,7,39,14
PUSHBUTTON "Exit",IDCANCEL,518,24,39,14
COMBOBOX IDC_Vendor,7,39,187,174,CBS_DROPDOWN |
CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS |
WS_VSCROLL | WS_TABSTOP
LTEXT "Vendor (gray=expired
green=permanent)",IDC_STATIC,37,
29,124,8
CONTROL "DateTimePicker1",IDC_ExpDate,"SysDateTimePick32",
DTS_RIGHTALIGN | WS_TABSTOP,225,37,49,15
COMBOBOX IDC_PayAcct,394,73,131,72,CBS_DROPDOWN | CBS_SORT
|
WS_VSCROLL | WS_TABSTOP
etc.

The second thing to look at is the initial control, the one that gets
the focus when the dialog is started. If you are handling
OnInitDialog, which is usual, you will see two lines at the end,
inserted by the MFC wizard,

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE

If you follow both of these, you should get the desired tab order. But
remember that some controls, such as static controls, will never get
the focus regardless of their order or properties.