Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Activecontrol returns name of grid not text box in grid
Message
De
05/08/2002 20:41:47
 
 
À
05/08/2002 04:34:38
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00686070
Message ID:
00686381
Vues:
40
Thanks Cetin,
fortunately for me so far that my column numbers and column orders are the same. I'll modify my code!
Regards

>Dave,
>Activecolumn returns the columnorder not actual columns collection index. A slight modification :
>
>
oX= THISFORM.ACTIVECONTROL
>IF oX.BASECLASS = "Grid"
>  nn= oX.ACTIVECOLUMN
>  IF BETWEEN(m.nn, 1, oX.COLUMNCOUNT)
>    for ix = 1 to ox.Columncount
>      if oX.COLUMNS(ix).Columnorder = m.nn
>	oX= EVALUATE("oX.Columns(m.ix)." + oX.COLUMNS(m.ix).CURRENTCONTROL)
>      endif
>    endfor
>  ELSE
>    ox= .F.  && or whatever step you wish to take :-)
>  ENDIF
>ENDIF
>
Cetin
>
>>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
Répondre
Fil
Voir

Click here to load this message in the networking platform