Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP5 and _CUROBJ
Message
De
30/11/1998 00:17:11
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00161344
Message ID:
00162322
Vues:
36
>Hi Bernard,
>
>They say one always thinks better on a full stomach, so after taking the day off yesterday for our Thanksgiving holiday (and stuffing myself with turkey and all the goodies) here's a solution I came up with which seems to work.
>
>1) add an array property called aControls to your form
>
>2) in the INIT of the form, populate the array with the tabindex and name of all its controls, and sort it
>
>with thisform
>   for i = 1 to .controlcount
>      dimension .aControls[i, 2]
>      .aControls[i, 1] = .controls[i].tabindex   && so we can sort by tab order
>      .aControls[i, 2] = .controls[i].name       && so we can ascan for the name
>   endfor
>   asort(.aControls)
>endwith
>
>
>3) in the Click event of the command button, use ASCAN() to locate the name of "this" (the command button) and add 2 to get the name of the control which comes next in the tab index sequence, then SetFocus to that control.
>
>local lnElement, lcControlName
>with thisform
>   * point to the name of the next control
>   lnElement = ascan(.aControls, this.name) + 2	
>   if lnElement <= alen(.aControls)            && be sure it's valid
>      lcControlName = .aControls[lnElement]    && get the name of the control
>      .&lcControlName..SetFocus()              && set focus to that control
>   endif
>endwith
>
>
>This should do what you want, since it doesn't require knowing the name of the control whose focus you want to set, only how far away it is in the tab order (similar to adding a number to OBJNUM in Fox 2.x).
>
>HTH,
>Rick

Thanks for your idea Rick. It should work for MOST objects.
On my form I have among others, a container with 10 buttons in it.
I also have Bitmaps and Lines/Circles/Shapes.

Problem1.
Bitmaps, Lines,Shapes DO NOT have a tabindex and so the line

.aControls[i, 1] = .controls[i].tabindex && so we can sort by tab order

Will fail. I will have to check out the help to find a way around this.

Problem 2
The container, as one of the objects on the form has its own tabindex. But each object inside the container, has its own separate tabindex which may/will be the same as an object on the form. Now which tabindex number will have precedence??

Eg. If I have 2 txtboxes, 2 buttons and a container with 2 buttons in it, the tab index may be as foll:

Form
txt1 - 1
txt2 - 2
butt1 - 3
butt2 - 4
container - 5

Container
butt1 - 1
butt2 - 2

As you can see VFP is extremely confusing in this TABINDEX business.

Your idea does have merit and I will be following it up as I do need this type of function. But I will have to find ways around this bitmap/line/shape pitfall as well as the mentioned container-tabindex one.

If, in the meanwhile, you have digested enough of the Turkey and wine, maybe you can clear this cloud from my mind??

Bernard
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform