Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with _Screen.ActiveForm.ActiveControl
Message
 
À
15/02/2001 16:19:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00476476
Message ID:
00476493
Vues:
25
>When I use the following “_Screen.ActiveForm.ActiveControl” I get an error message which states that the "Active.Control" is not an object. So How do I find out what the active control is (during run time)?

Andy, there may be no ActiveControl in the form, or may be no form active at the moment.

.ActiveControl points you to the control which has the focus. As an example:
.ActiveControl just doesn't work in When event. The control doesn't become ActiveControl until When returns .T. and it's GotFocus fired. So, there are moments when you cannot get the .ActiveControl object reference.

It is better to always wrap any .ActiveControl... references into IF like this:

IF TYPE("_screen.ActiveForm.ActiveControl") = "O" AND !ISNULL("_screen.ActiveForm.ActiveControl")
* your code here.
ENDIF

Also, in VFP 6 you should use TYPE() function rather than VARTYPE() because VARTYPE() can choke if the object is unknown.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform