General information
Category:
Forms & Form designer
Title:
Activecontrol returns name of grid not text box in grid
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only