Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically Building Menu Options

Status
Not open for further replies.

tryn2learn

Programmer
Jun 26, 2000
24
US
I'm trying to add the last 3 product numbers searched off of my menu. (Like you see the last several documents you've accessed in Word). I'm not sure how to dynamically create these options off of the menu. Any suggestions?
 
As long as you know the Menu Pad's "name", you can add and change the bar's to your heart's content. For example I modify the Visual FoxPro menu in development mode with the following:

DEFINE BAR 10 OF _MSYSTEM PROMPT "\-"
DEFINE BAR 11 OF _MSYSTEM PROMPT &quot;\<Filer&quot; ;
MESSAGE &quot;Finds files and directories&quot;
ON SELECTION BAR 11 OF _MSYSTEM ;
DO FORM (HOME()+&quot;ADD-ONS\FILER\FILER&quot;)
DEFINE BAR 12 OF _MSYSTEM PROMPT &quot;Ca\<lculator&quot; ;
MESSAGE &quot;Perform calculations&quot;
ON SELECTION BAR 12 OF _MSYSTEM ACTIVATE WINDOW calculator
DEFINE BAR 13 OF _MSYSTEM PROMPT &quot;Calendar/D\<iary&quot; ;
MESSAGE &quot;Check dates and keep track of appointments&quot;
ON SELECTION BAR 13 OF _MSYSTEM ACTIVATE WINDOW calendar
DEFINE BAR 15 OF _MSYSTEM PROMPT &quot;\-&quot;
DEFINE BAR 16 OF _MSYSTEM PROMPT &quot;Di\<rectory...&quot; ;
MESSAGE &quot;Change directory&quot;
ON SELECTION BAR 16 OF _MSYSTEM CD?
DEFINE BAR 17 OF _MSYSTEM PROMPT &quot;File to \<Clipboard...&quot; ;
MESSAGE &quot;Get file dialog to clipboard&quot;
ON SELECTION BAR 17 OF _MSYSTEM _CLIPTEXT=LOWER(GETFILE())

When I was doing cross-platform development in FPD and FPW, one distracting problem was how the menus were totally different. So I simply &quot;redesigned&quot; the FPD menu to be (almost) identical to FPW - it made finding things so much easier when switching back and forth.

Note: As long as a BAR isn't defined, it can be used, and FoxPro doesn't &quot;worry&quot; if some of the numbered bars are missing. Look at the syntax for RELEASE BAR and check out more example code in the DEFINE BAR help topic.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top