Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic menu option
Message
From
03/11/2005 10:53:11
 
 
To
03/11/2005 09:33:49
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01064856
Message ID:
01064983
Views:
28
>>>Hi All
>>>
>>>I have a program that constructs a top menu using DEFINE PAD's and ON PAD ... ACTIVATE POPUP commands. This all works ok. However, is there a way that each time a user clicks a particular PAD that I can first run a function which re-creates the applicable POPUP so that I can add/remove menu items from it?
>>>
>>>I tried ON SELECTION PAD ... DO command which then ACTIVATES the POPUP but this displays the POPUP menu in the top left corner of the main window underneath the menu bar and any toolbars.
>>
>>
>>DEFINE PAD thispad of thismenu .... SKIP FOR NOT REFRESHPAD('thispad','thismenu')
>>
>>PROCEDURE REFRESHPAD(cPad,cMenu)
>>DO CASE
>> CASE cPad=...
>>  RELEASE POPUP ...
>>  * REBUILD POPUP
>>ENDCASE
>>
>
>Hi Fabio. I tried this but I get a strange behaviour.
>
>1) The main pad displays on the top menu and the SKIP FOR has fired my routine.
>
>2) Clicking any menu pad also fires the function defined in the SKIP FOR ?
>
>3) When I click on the pad whose popup I want to adjust it shows the menu, with only the first option shown, and then the popup disappears.
>
>Any ideas what I am doing wrong?
>
>Thanks

All good or all bad :)

On VFP when you enter into a top form menu
ALL the pads of ALL top form menus are refreshed.

TRY THIS:
DEFINE PAD TOPPAD OF _MSYSMENU PROMPT 'ThePad' SKIP FOR NOT refreshPad()

ON PAD TOPPAD OF _MSYSMENU ACTIVATE POPUP thePopup

PROCEDURE refreshPad
  DEFINE POPUP thePopup
  FOR k=1 TO RAND()*10
    DEFINE BAR k OF thePopup PROMPT STR(m.k)
  NEXT
ENDPROC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform