Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ActiveForm is not an object
Message
De
18/12/1999 23:55:30
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
18/12/1999 12:32:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00305647
Message ID:
00305781
Vues:
29
>>Hi,
>> I have a top level form and multiple MDI form. I place toolbar on my top level form and issue _SCREEN.ACTIVEFORM.mymethod(). It works most of the time, but VFP give error ACTIVEFORM is not an Object sometime... why does it happen? hor to solve?
>>
>>Thank you
>
>Sometimes, there is no ActiveForm at that time. It's safer to look for the form you really need, and use its reference to call the method, e.g.
>
>For Each oForm in _SCREEN.Forms
> If oForm.Name=="MyForm"
>  oForm.mymethod()
>  Exit
> Endif
>Endfor
>
Another thing which worked fine in 5.0 but behaves differently in 6, is that sometimes the _screen.activeform will not return a referrence to the active form, but to an ActiveX sitting on that form. One solution is to do something like this:
Function ActiveForm
oForm=_screen.ActiveForm
if not isnull(oForm)     && or should we check for type('oForm')='O'?
 do while oForm.BaseClass#'Form'
   oForm=oForm.parent
 enddo
endif
return oForm
This function may return .null.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform