Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add selections programmatically
Message
From
28/02/2008 07:38:03
 
 
To
27/02/2008 15:30:48
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
01296923
Message ID:
01297315
Views:
19
>>>Suppose you have an applications main menu tree defined as:
>>>
>>>File
>>>  Choice 1
>>>  Choice 2
>>>
>>>Surveys
>>>  Choice 1
>>>  Choice 2
>>>  Print
>>>    Choice 1
>>>    Choice 2
>>>    Special Report
>>>
>>>Other Items
>>>
>>>Can someone clarify for me what is a menu bar, what is a menu pad, and what is a menu popup?
>>
>>A menu is a list of selectable items. Now some smartass somewhere decided that it has to have one set of names for the case when this list is horizontal and a completely different one when it's vertical, although the logic is just the same.
>>So, if it's horizontal it's called a menu and has pads. If it's vertical it's a popup (or popup menu) and has bars. A menu pad can do something or open a popup; a popup bar can do something or open another popup (thus cascading to any depth until you get something like Word 2.0), but it can't open a menu (did you ever see a horizontal list spread out of a vertical? neither have I).
>>
>>VFP (and FP for that matter) complies to this nonsense to the end. There's a separate set of functions for the horizontal and for the vertical.
>>
>>>Secondly, if we wanted to further subdivide Special Report programmatically based on values in a table, would the code belong in the setup code or the cleanup code? I am guessing the setup code but is that correct? And finally, what would be the code commands to add these additional selections? I have done this in a previous application but I had to build the entire tree from Surveys on down. Is it possible to start with the tree already defined and just add to it?
>>
>>Check Define Bar and On Selection Bar - you can add more bars to an existing popup.
>
>Thanks Dragan.
>So just to make certain I am clear on the definitions, the selections that appear across the top when the menu is not in use are called PADS. Beneath those, the selections that open up other selections (the betweeners) are called popups, and the last selections in the tree are called bars. Would that be correct?
>
>In my example File, Surveys, and Other Items are pads.
>File/Choice1 and File/Choice2 are popups.
>Surveys/Choice 1 and Surveys/Choice 2 are popups.
>Surveys/Print is a popup.
>Everything below Surveys/Print is a bar because they actually execute command or procedure code.
>Would that be correct?
>
>And would you put the additional code (to add more bars) in setup or cleanup, or doesn't it matter?

Hi Don,

here's some code that I use in my startup program for my development environment that may help:
m.lnCntBar = CNTBAR('_mTools') + 1
DEFINE BAR m.lnCntBar OF _mtools PROMPT "FoxUnit"
ON SELECTION BAR m.lnCntBar OF _mtools DO fxu.prg
This counts how many bars are already defined on the _mtools pad, then adds a new bar in that calls my fxu.prg.

Another useful function is GETBAR().

You can only run this kind of code after your menu has been defined, so either put it in some code that runs after your DO MENU, the Cleanup of the menu may work, but you may forget it is there.

Hope that helps.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform