Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Executing a menu command from a form?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00088965
Message ID:
00089172
Vues:
23
>>>>>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
James,
Then you could move the toolbar.click to form.unload. Only visibility of form could be a problem and set visible=.f. A better way I think adding this menu item's code to the code that called the form.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform