Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remember last menu accessed
Message
De
18/01/1999 16:06:41
 
 
À
18/01/1999 14:32:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Divers
Thread ID:
00177312
Message ID:
00177341
Vues:
38
>Is there a way in VFP6 to remember what menu item u selected? After releasing the form u do, I want to highlight the menu that I last accessed even if I am inside a submenu. Thanks.

Richard,

There is not native VFP function/method to remember your current menu, but you can easily keep track of it in your application object.

I put a method in my app object to display menus. The method also keeps track of the name of the current menu just in case I need it for any purpose.
*--Base_app.DoMenu()
*-------------------------------------------------------------------------------
*
*  METHOD: .DoMenu()
*			:
*  OVERVIEW: Displays the menu identified in lcMenu.
*			:
*  SYNTAX:   obj.DoMenu("Menu.mpr") where the argument is the 
*            name of a menu file.
*
*  USES:     .aMenus[1] -- Array property of this object.
*            .cBaseMenu -- Character property of this object which contains
*                          the name of the base menu (i.e. the menu that 
*                          is displayed when no forms are open).
*
*  NOTE:     If menu extention is not supplied, routine uses the default
*            extension.
*
*-------------------------------------------------------------------------------

LPARAMETER lcMenu

IF TYPE("lcMenu") # "C"
    MESSAGEBOX(;
	"Menu name passed to oApp.DoMenu "+;
	"is not a string.  Unable to display the menu.",;
	0,;
	"Invalid Menu Name")
    RETURN
ENDIF

LOCAL lnANewLen

WITH this
    IF !("." $ lcMenu)
	*-- No extension.  Provide the default extension
	lcMenu = ALLTRIM(lcMenu)+".mpr"
    ENDIF
    *-- Add the menu to the menu array
    IF TYPE("this.aMenus") # "C" .OR. lcMenu = .cBaseMenu
	.aMenus[1] = lcMenu
    ELSE
	lnANewLen = ALEN(.aMenus) + 1
	DIMENSION .aMenus[lnANewLen]
	.aMenus[lnANewLen] = lcMenu
    ENDIF	
ENDWITH

DO (lcMenu)

RETURN
I am certain there are many better ways of doing this, but for what its worth, this is how I do it.

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform