Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No luck using FORM.ActiveControl
Message
From
11/11/1998 12:55:14
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, California, United States
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00156203
Message ID:
00156661
Views:
41
ActiveControl can be a little weird sometimes, especially when looking at it from event-based procedures. For example, if you have a form, a toolbar, and a modal form if you click the toolbar and chek form _screen.activeform.activecontrol, it will not return a value until the Activate event of the underlying form finishes executing.

You might want to try explicitly calling the Activate of the form, if that is an option. If you give some more details as to the specifics it might be easier to help to figure out why the form doesn't have the focus.

>Juan,
>
>But where are you checking ActiveControl? The Timer event of a timer? Is the Timer a member of the same form? A method of a Toolbar? The place you are running the code from may be what's making ActiveControl invalid. I was trying to give you an alternative to having to track the current control with a separate property and the complexity it causes.
>
>>I am currently attempting this with an Edit Control. However, it appear that what ever object I try this with it fails.
>>
>>I have tried _SCREEN.ActiveForm and I can get the name of the form in focus. Although, if I were to go a little further and issue a _SCREEN.ActiveForm.ActiveControl I never get a reference to the currently focused object.
>>
>>As a work around, I've implemented something that Edward Pikman recommended. Eds approach was to create a property on the form to keep track of the last focused object, and in every object's GotFocus event, update that form property.
Eric Shaneson
Cutting Edge Consulting
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform