Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ThisForm.ActiveControl Returns Not An Object
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00510492
Message ID:
00510496
Views:
14
Scott,
IF TYPE("ThisForm.ActiveControl.Name") = "C" will return .T. if ActiveControl is a valid object with a Name property. Do not use Vartype() for this as it is not robust enough for the checking and it will throw an error.

The same can be done with variables.

HTH.

>I'm using the following code to determine what control is currently active:
>
>lControl=ThisForm.ActiveControl.Name
>
>Looks simple,right? You'd think so. I've got an ON KEY LABEL F10 in the Activate of a text box, which pops up a list of possible values for the text box. That code above is called from another ON KEY LABEL, but this one is attached to F11. Here's my problem. Some of the users simultaneously hit F10, and F11 (I don't know how they manage it), and about 1 out of 5 times, that code comes up (after they clear out of the possible values list), with "ACTIVECONTROL is not an object", and bombs the program.
>
>I know WHY it's happening, but I need some way to determine if an control has focus on the main form (everything I have tried has given me the exact same, Not an object error). I've had this same problem with Variables, trying to access them before they are instantiated.
>
>Anyone know an easy way to determine if ACTIVECONTROL is an object, and/or if there is any way to determine if a variable is defined?
>
>Scott
>
>The needs of the many outweight the needs of the few, or the one....
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform