Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activecontrol returns name of grid not text box in grid
Message
From
05/08/2002 04:34:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/08/2002 22:03:36
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00686070
Message ID:
00686103
Views:
42
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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform