Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Activecontrol returns name of grid not text box in grid
Message
De
04/08/2002 22:03:36
 
 
À
04/08/2002 20:18:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00686070
Message ID:
00686076
Vues:
42
Here's a code fragment i use from my forms "writebuffer" method. I hope it gives you an idea.

oX= THISFORM.ACTIVECONTROL
IF oX.BASECLASS = "Grid"
nn= oX.ACTIVECOLUMN
IF BETWEEN(m.nn, 1, oX.COLUMNCOUNT)
oX= EVALUATE("oX.Columns(m.nn)." + oX.COLUMNS(m.nn).CURRENTCONTROL)
ELSE
ok= .F. && or whatever step you wish to take :-)
ENDIF
ENDIF

>I wrote a routine to return the active control and its full containership hierarchy. It seems to work fine, EXCEPT that activecontrol always returns the name of the grid, not the text box, or other control that has the focus within a grid. It seems to work fine on all other controls except the grid.
>
>The text box or other controls in the grid are editable, i can type in them no problem. They definitely have focus at the time I call them. At first I tried this with a grid that had a container with a text box and command button in it - when that didn't work I simplified it - and just called it from a simple grid with the default text box control in the column.
>
>
>This is a real problem, because it will almost always be called when the focus is in a text box in a grid! Any suggestions would be greatly appreciated!!!
>
>
>I call this routine from an on key label f9
>
>The code for getting the containership hierarchy is below:
>
>procedure getactivecontrolhierarchy
>If type('_screen.activeform.activecontrol')='O'
>
> lccontrol= _screen.activeform.activecontrol.name
> lcobjectname=lccontrol
> If type('lccontrol') <> 'U'
> lcparentstring=''
> Do while .t.
> lcparentstring=lcparentstring+ 'parent.'
> lcparentstringfortest=lcparentstring+'parent'
> lcrest=lcparentstring+'name'
> If type('_screen.activeform.activecontrol.&lcparentstringfortest') = 'O'
> lcparentname = _screen.activeform.activecontrol.&lcrest
> lcobjectname=lcparentname+"."+lcobjectname
> Else
> Exit
> Endif
> Enddo
>
> Endif
>Else
> Wait wind 'No controls are active'
>Endif
>endproc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform