Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hacking a menu system
Message
De
30/04/2004 09:09:05
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Titre:
Hacking a menu system
Divers
Thread ID:
00899707
Message ID:
00899707
Vues:
63
Hi,

I wrote a small routine (VFP8 SP1) to loop thru a menu system (like the example below) and get all of its elements names and prompts.

It seems to work ok, but only until the first level of the menu system, i.e. it gets all the pads of _MSysMenu and all the bars of 'MyPopUpName1', but it can't go (actually I don't know how) thru the next level namely 'MyPopUpName2'.
Define Pad MyPadName of  _MSysMenu  Prompt " MyPadName \<Prompt "
On     Pad MyPadName of  _MSysMenu  Activate PopUp MyPopUpName1

Define PopUp MyPopUpName1

       Define Bar 1 of MyPopUpName1 Prompt " MyPopUpName1 Bar \<1 Prompt "
       Define Bar 2 of MyPopUpName1 Prompt " MyPopUpName1 Bar \<2 Prompt "
       Define Bar 3 of MyPopUpName1 Prompt " MyPopUpName1 Bar \<3 Prompt "

       On     Bar 1 of MyPopUpName1 Activate PopUp MyPopUpName2
       On     Bar 2 of MyPopUpName1 ...
       On     Bar 2 of MyPopUpName1 ...

       Define PopUp MyPopUpName2

              Define Bar 1 of MyPopUpName2 Prompt " MyPopUpName2 Bar \<1 Prompt "
              Define Bar 2 of MyPopUpName2 Prompt " MyPopUpName2 Bar \<2 Prompt "
              Define Bar 3 of MyPopUpName2 Prompt " MyPopUpName2 Bar \<3 Prompt "
Below is the routine I put just after the definition of the entire menu system:
 cMainMenu = "_MSysMenu"

 nCntPad = CntPad (cMainMenu)

 For nPad = 1 To nCntPad

     cMenuName   = Lower (GetPad (cMainMenu, nPad     ))
     cMenuPrompt =        PrmPad (cMainMenu, cMenuName) 
 
     Messagebox (cMainMenu + "." + ;
                 cMenuName + " [" + cMenuPrompt + "]")
 
     Define Pad &cMenuName of &cMainMenu Prompt Upper (cMenuPrompt)
 
     nCntBar = CntBar (cMenuName)

     If nCntBar > 0
        LoopThruBars (cMenuName, nCntBar)
     endif

 EndFor

 Procedure LoopThruBars
*--------- ------------
 LParameters pMenuName, pCntBar

 Local       cMenuName, nCntBar, nBar

 cMenuName = pMenuName
  
 For nBar = 1 To pCntBar
 
     nBarPosition = GetBar (cMenuName, nBar        )
     cBarPrompt   = PrmBar (cMenuName, nBarPosition)
     cBarPosition = lTrim  (Str       (nBarPosition))
 
     MessageBox (cMainMenu    + "." + ;
                 cMenuName    + "." + ;
                 cBarPosition + " [" + cBarPrompt + "]")
 
     If ! Empty (cBarPrompt)
        Define Bar  &cBarPosition of &cMenuName Prompt Upper (cBarPrompt)
     endif

*    nCntBar = CntBar (cMenuName)
*    nCntBar = CntPad (cMenuName)

*    If nCntBar > 0
*       LoopThruBars (cMenuName, nCntBar)
*    endif
 
 EndFor

 EndProc 
Any ideas or help on how to achieve my goal will be very appreciated.

TIA,

Fernando
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform