Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically updating Window menu item on the main menu
Message
 
À
07/04/2001 08:00:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Divers
Thread ID:
00493173
Message ID:
00493179
Vues:
13
>hello all,
>
>could u pls let me know how i can program the main menu of my application to have a WINDOW menu option which gets dynamically updated whenever multiple forms are opened in the application (like we have in MS WORD etc.)
>
>thanks in anticipation


The mani idea is that it the INIT of your form you add the form to the menu with the following code
	IF !POPUP("Venster")
		*- need to define Venster menu
		DO menus\window.mpr 
	ENDIF
	*-- Find the next available bar number
	IF CNTBAR("Venster") = 0 OR ;
		GETBAR("Venster", CNTBAR("Venster")) < 0     && At a Fox system BAR
		lnBar = CNTBAR("Venster") + 1
	ELSE
		lnBar = GETBAR("Venster", CNTBAR("Venster")) + 1
	ENDIF
	DEFINE BAR lnBar OF Venster PROMPT thisform.caption 
	lcFormName = thisform.Name
	ON SELECTION BAR lnBar OF Venster ACTIVATE Window &lcFormName
And in the destroy of the form you can use this to remove it again
*-- Remove the form's caption from the Window menu popup.
*-- We check to see if the application object
*-- exists to prevent error messages when running
*-- the form outside the project
IF TYPE('oApp') == "O"
  FOR lnBar = CNTBAR("Venster") TO 1 STEP -1
    IF PRMBAR("Venster", GETBAR("Venster", lnBar)) = lcCaption
      RELEASE BAR GETBAR("Venster", lnBar) OF Venster
      EXIT
    ENDIF
  ENDFOR
  IF CNTBAR("Venster") = 0
  	*- now menu is empty so remove it
  	RELEASE POPUP Venster EXTENDED
  	RELEASE PAD window OF _msysmenu
  ENDIF

ENDIF
You may also look at theTasTrade examle for more details as João said.
The best you place this code in the base class for your forms.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform