Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setfocus based on Tab Order = 1?
Message
From
12/11/1997 17:56:32
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00059420
Message ID:
00059813
Views:
43
>>>>>lnMin = 9999 >>>>> >>>>>FOR lnI = 1 TO _Screen.ActiveForm.ControlCount >>>>> IF _Screen.ActiveControl.TabIndex < lnMin >>>>> lnMin = _Screen.ActiveControl.TabIndex >>>>> loControl = _Screen.ActiveControl >>>>> ENDIF >>>>>ENDFOR >>>>> >>>>>loControl.SetFocus() >>>> [snip, snip] >>3. Are you sure you'll always have a TabIndex = 1? >> >>Vlad > >Yeah, I'm pretty sure that the control with TabIndex=1 will always be the >one I want. I always have to go in and set the tab order anyway so I just >set the field I want to TabIndex=1. This has been discussed several months ago. It was suggested that the finding of the first active control should go to form.init (unless you intend to play with changing tab order at runtime, which is unlikely to make users happy), and have a form property memorizing the control's index (in the form.controls[i] array). This way it's done only once. I am doing another thing - I have an array property on the form containing focusable controls (i.e. their indexes) sorted by their tab indexes, and assign the index into this array as an additional property to all the controls (all in the form.init), so it's quite easy then to know a control's next and previous neighbour as ordered by tabindex. This kind of index juggling is a bit harder to implement, but it's safer than making object references, which are hard to kill later.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform