Discussions related to Visual Prolog
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

tabstops and visit order

Unread post by Audun Tönnesen »

I notice a strange behaviour in a form with some static texts and several types of controls.
When I press resource/tabstops, the correct marking is displayed: all the static texts have a 'minus,' and all the data-controls a 'plus.'

But when I press resource/visit order, all the static texts are also assigned a visit order, even though they don't have the tabstop-property. This is very inconvenient.
Is this an intended behaviour?
Regards,
Audun.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Yes, it is the intended behavior, and it is indeed necessary.

If you have a static text with an accelerator, say "&Name" (= Name), then when the user press Alt+n (the accelerator), focus will be transferred to the first control with tab-stop in the visit order after "&Name". I.e. go to the static text and then follow the visit order until you meet a control that have tab-stop.

So the visit order of static texts does matter (and hence it is necessary to control it).
Regards Thomas Linder Puls
PDC
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

Unread post by Audun Tönnesen »

Let's say I have a simple form:

1-statick text prompt
2-edit control for input
3- static text prompt
4-edit control for input.

The, the visit-order wil be 1,2,3 and 4 ?
Regards,
Audun.
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

Unread post by Audun Tönnesen »

....and no accelerators (example above), just plain static texts.
Regards,
Audun.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

By default the visit order will be the order in which you add the controls to your dialog.

I.e. the first control you add to the dialog (in the dialog editor) will be visited first, the second control you add will be visited second, ...

But using the Resource -> Visit Order you can change the visit order to something different.

The visit order is not affected by accelerators, it is the opposite way: then meaning/effect of accelerators is affected by the visit order.

Let me explain the "accelerator" stuff by means of an example.

Consider controls like this:
  1. Tabstop, no-accelerator (e.g. an edit control)
  2. No-tabstop, Accelerator A (e.g. a static text)
  3. Tabstop, no-accelerator (e.g. an edit control)
  4. Tabstop, Accelerator A (e.g. a button)
If the user presses Alt+B nothing will happen because no control have B as accelerator.

This is what happens if a certain control has focus and the user presses Alt+A
  1. Windows searches for the accelerator (forward in visit order) and finds control 2. Control 2 does not have tabstop, so Windows searches forward for a control with tabstop and finds control 3. Focus is set to control 3.
  2. Windows searches for the accelerator and finds control 4. Control 4 have tabstop. Focus is set to Control 4.
  3. Same behavior as control 2.
  4. Same behavior as Control 1, because searches cycles round once the last control is reached
If you change the visit order like this:
  1. Tabstop, no-accelerator (e.g. an edit control)
  2. Tabstop, no-accelerator (e.g. an edit control)
  3. No-tabstop, Accelerator A (e.g. a static text)
  4. Tabstop, Accelerator A (e.g. a button)
Alt-A will go to Control 4, no matter which control that have focus.
Regards Thomas Linder Puls
PDC
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

Unread post by Audun Tönnesen »

Yes, now I start to understand it better. Again, thanks for your patience!

In my case (I have a quite big form), the intention is that the user starts at the top, and fills in data down the "page." She will proceed from control to control using the Tab-key. No accelerators.
In that use-case, I suppose I can just assign the controls (including static text prompts) numbers from 1 and upwards?
Regards,
Audun.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

For most dialogs normal reading order will be the best.
Regards Thomas Linder Puls
PDC
Post Reply