Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding the object with TabIndex=1
Message
 
À
25/01/1999 13:25:27
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00179913
Message ID:
00180042
Vues:
18
>Using VFP6 - I have a pageframe with multiple pages and each time the user changes the page I want the cursor to go to the first object on the new page. Is there any easy way of finding the first object on the page without hardcoding it?
>
>Thanks-

I read Rich and Nancy's replies but you can easily write a method to accomodate what you want. I've one called .SetFocusThisIndex(oTheContainer, nSomeTaxIndex)
and it's in my template base class making it available to all my forms.

I pass oTheContainer because this allows you to access any type of object in which form controls might be placed, including pages of a pageframe. The 2nd parameter allows more flexibility because you can choose the tabindex you need to set focus to.

.SetFocusThisIndex

LPARAMETERS roContainer, vnIndex
LOCAL i
*
* Make vnIndex 1 if not passed
*
IF PARAMETERS() < 2 OR vnIndex = 0
vnIndex = 1
ENDIF
*
* Loop through the container object and find the match.
*
WITH roContainer

FOR i = 1 TO .ControlCount

IF NOT INLIST(UPPER(.Controls[i].Class), ;
"LABEL", "CONTAINER", "SHAPE", "PAGEFRAME")
*
* Make sure it's not in above list.
*
IF PEMSTATUS(.Controls[i], "TabIndex", 5)
*
* Make sure it has a tabindex property
*
IF .Controls[i].TabIndex = vnIndex
.Controls[i].SetFocus()
ENDIF
ENDIF
ENDIF

ENDFOR

ENDWITH

This ought to do it for you.

Steve
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform