Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid.Gotfocus()???
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00143667
Message ID:
00143752
Views:
17
>>Hi all,
>>
>>I am looking for an elegant way to programmatically keep track of whether any control in a grid has focus. I would like to expand the grid to display more rows when one of its controls has focus, and contract it again to save screen space when none of the controls on the form has focus.
>>
>>So far I have figured out a way of keeping track at the form level, but nothing self-contained withing the grid wihtout using a timer.
>>
>>Any suggestions would be greatly appreciated.
>>
>>regards,
>
>Hi there,
>
> IF 'any control in a grid' does not include Column Header object,you can determine current focus object by putting some code in each column's Textbox(or may any other control). Create one property on the Form and play with it.
>
>e.g. In Grid.Column1.text1.GotFocus(),Put Thisform.lGridHasFocus = .T.
>Same way in LostFocus(),Put Thisform.lGridHasFocus = .F.


Jayesh,

Thank you for your reply. What you suggest is essentially what I am doing now.

When a control gets focus, the grid's "hasfocus" property to true. When it loses focus, it sets the hasfocus property to false. Then if focus is gained by another control in the grid, the hasfocus property is set to true again.

When the grid's hadfocus event is first set to true, the grid is expanded to a height that displays all of the items in the grid up to a maximum of 10 lines, and a timer on the form is set on with an interval of 1 second. If the timer subsequently detects that the hasfocus event has been false for more than 1 second, which would happen if a control outside of the grid had gotten focus, it collapses the grid to one row and turns itself off.

I do not like using the timer, and I was hoping someone had thought up a more elegant solution that could be contained within the grid class.

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform