Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Menus in Forms
Message
From
06/12/2012 02:54:01
 
 
To
05/12/2012 18:05:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01558747
Message ID:
01558901
Views:
111
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform