Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic menus from a table
Message
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00347290
Message ID:
00347370
Views:
18
>The 'Application' pad of our system main menu is based on a table, and it will pop up only the bars that apply to a specific user, or platform (FPW/VFP), or any other filters that we decide...
>
>Here is how we did it:
>
>1. Maintain a table with fields for:
>-mprompt = menu bar prompt
>-mprogram = the program to be run from menu bar command
>-other filter type fields: access, platform, date obsolete,...
>
>2. In the menu designer, define any number of 'empty' bars (nothing in the command) under the pad 'Applications' (you can have submenus too.)
>
>3. The main program looks something like this:
>
>do mainmenu.mpr
>read valid .f.
>
>select apptable  && cursor from the app table, with the appropiate filters
>
>* re-define the empty bars
>nbar=0
>scan
>  *-- this becomes a 'do case' structure if you have submenus
>  nbar=nbar+1
>  defi bar nbar of applications prompt ' '+alltrim(sky_menu.win_title)+' '


OOPs!!
<b>  defi bar nbar of applications prompt ' '+alltrim(mprompt)+' '</b>


>endscan
>
>*-- release unused bars - also a 'do case' structure if you have submenus
>do while nbar<=26
>  nbar=nbar+1
>  release bar nbar of applications
>enddo
>
>*-- define bar command
>on selection popup applications do do_app with prompt()
>
>*-------------------
>procedure do_app
>para barprompt
>
>loca for mprompt=subs(barprompt,2,len(mprompt))
>do (mprogram)
>
>
Doru
Previous
Reply
Map
View

Click here to load this message in the networking platform