Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executing a menu command from a form?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00088965
Message ID:
00089013
Views:
25
>>>>>Is there anyway to execute a menu item programmatically from a form?
>>>>>There is a special situation where I need this to happen.
>>>>>
>>>>>TIA,
>>>>>
>>>>>James
>>>>
>>>>Why can't you expicitly call command which is behind the menu bar item?
>>>
>>>Here is my situation. I am trying to run a utility program from a form that calls a routine that closes down any open screens to ensure all tables are closed before the utility runs. I can run this utility from the menu and all the forms shutdown properly. If I run it from the form, the form I run it from closes down, but no other open forms will close. Maybe this is not possible, but I thought I would try to see if there is a way to accomplish this. Now that I think about it, I don't think running the menu item code from the form would work either. Probably would be the same situation. Then you may say, since the utility shuts down the forms from the menu, then don't put it on the form. I have a startup form that uses the ctListBar control from dbi-Tech (outlook style bar) and I have utilities under one of the bars and I run the utility from there.
>>>
>>>Anyway, bottom line is, the forms will not close when run from the form, but the forms do close when run from the menu.
>>>
>>>Any help would be appreciate! Either I am missing something or this is just not possible from a form.
>>>
>>>Thanks for any insight you can give me.
>>>
>>>James
>>Now,
>>You could get forms collection and release them before releasing the current. Still for doing a menu click you may also want to coordinate a toolbar with menu (sample in solutions.app). Then all you need would be something like "oToolbar.cmdCloseAll.click".
>>Cetin
>
>Cetin,
>
>Thanks for your response. I gave this a try, but (just as Ed mentioned) after the oToolbar.cmdClose.click() is run in the toolbar, control still returns to the form I called the oToolbar.cmdClose.Click() from which is creating my problem. The calling form does not shutdown until after the oToolbar.cmdClose.Click() has been run. I somehow need the form to close and then the oToolbar.cmdClose.Click() run. I guess there is no way to do this from within a form since the control will always return back to the calling form.
>
>Do you know of any work around that this could be accomplished?
>
>Thanks again,
>
>James

Usually, this kind of situation can be resolved by timer, you launch _SCREEN.Timer from Form.button.click event, on first timer event the timer will shut off all forms, on second it will run your utility, and on third it will restore all forms.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform