Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Menus in Forms
Message
De
06/12/2012 02:54:01
 
 
À
05/12/2012 18:05:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01558747
Message ID:
01558901
Vues:
110
This message has been marked as a message which has helped to the initial question of the thread.
>Setting Desktop, either to .T. or .F., works perfectly.
>
>As the Desktop property is readonly, I cannot change its value inside the form's code. So I created a variable (bDeskTop) to set this property in the definition of the form, but whatever is the value of bDeskTop (.T. or .F.) it only works in the first invocation on the form. The next time it simply ignores the value.
>
>There is a way to workaround this situation?
>
> bDeskTop = .F.
>
> oMyForm  = CreateObj ("frmMyForm") && The form will be created inside _Screen.
> oMyForm.Show ()
>
> Clear Events
>
> bDeskTop = .T.
>
> oMyForm  = CreateObj ("frmMyForm")  && It doesn't change, the form is created inside _Screen again.
> oMyForm.Show ()
>
> Clear Events
>
> Define Class frmMyForm as Form
>         . . . 
>        Desktop = bDeskTop
>         . . . 
> EndDefine
>
The reason it doesn't work the second time is that the form's definition is cached in memory ( to speed up) and it uses the first definition

Maybe before the second invocation
clear class frmMyForm  && see help
But the wisest would be to subclass frmMyForm, then instantiate either one of the classes
 Define Class frmMyForm as Form
         . . . 
        Desktop = .f.
         . . . 
 EndDefine

 Define Class frmMyFormDesktop  as frmMyForm 
         . . . 
        Desktop = .t.
         . . . 
 EndDefine
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform