Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Before I Hack - How to Change Main Menu by App
Message
De
19/06/2002 18:02:27
 
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00664891
Message ID:
00670337
Vues:
30
Kevin,

As a test, if I put in my application class method Showmenu()
This.AddObject("omenu","mainmenu","goapp.omenu")
This.ReleaseMenu()
This.AddObject("omenu","mainmenu","goapp.omenu")
it will start, clear and redisplay the mainmenu OK.
If I substitute another menu class as in
This.AddObject("omenu",goapp.ICSFactory.GetClassName('GL_MainMenu'),goapp.omenu")
then two problems occur:
(1) Although, I have renamed my GL project 'amenus' classlib to 'aGLMenus', the main menu class is still 'mainmenu', so it appears the origial 'mainmenu' class is seen first and that is the one instantiated. Do I have to also rename all my menu class names to be unique between projects to have the right ones picked up?
(2) When the menus are swapped in and out from a method originating on the application class like the test above (forgetting the wrong one is instantiating) they work, however, when I call a method I've added to myAppClass.ShowAnyMenu() from a menubar click it Instantiates OK (forgetting the wrong one is instantiating) and then immediately I see each menubar and Pad destroy event fire and the whole menu is removed. It's almost as If because the menu and menubar that made the call to remove and replace itself, after the call is complete, the destroy methods run against the new menu. In other words, calling a app method to swap a menu from a menu pad click, I can't get it to stay around after it's built.
myAppClass.ShowAnyMenu
LPARAMETERS tcMenuClass
IF PCOUNT() < 1
   tcMenuClass = "MainMenu"
ENDIF
THIS.ReleaseMenu()
IF VARTYPE(this.omenu) == "U"
   THIS.ADDOBJECT('omenu',THIS.oICSFactory.GetClassName (tcMenuClass), "goApp.oMenu")
ENDIF
Stuck again,

Gary Pike.


>Gary,
>
>>Does anyone have a solution they are using that works well?
>
>I tried the following code in the MM sample application...does this code work in your app?
>
>
>This.ReleaseMenu()
>This.AddObject("omenu","mainmenu","goapp.omenu")
>
>
>Regards,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform