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:
00510657
Views:
13
Scott,

I'll raise the bigger issue since no one else has.

Stop using OKLs.

Either your control itself should be checking for special key hits, or the form can test in KeyPress() when KeyPreview = .t. This allows you to encapsulate the functionality where it belongs.

>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?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform