Re: Cut and Paste programming problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Sun, 25 Nov 2007 21:24:08 -0800, Gene Wirchenko <genew@xxxxxxxx>
wrote:


When my system starts up, it sets up the menu. This is done in
my application object. (I may be using this term differently than
others might. It is simply a custom object where some app-level
processing is done.) The menu works just fine.

I tried to make a change that would affect the menu.
Specifically, I meant to restrict access to certain parts. This did
not work as expected. If I exited the app and restarted it, it worked
as expected: the new settings for the menu were respected, and the
menu was generated correctly.

However, the menu did not change properly right after the
settings were changed. I traced through my code, and the new
(replacement) menu was correctly generated, but when the return from
my app object method (that set up the menu) was executed, the menu
reverted to the previous version.

I have been unable to figure out why this happens. I do not even
know if I hit a VFP bug or there is something subtly wrong about the
way I set up the menu. (I thought I was following an example.)

I discovered the following when I added code to my app to modify the
menu on the fly.

I built a modal form to collect information from the user. In the
modal form I modified the menu of the calling Top Level form. The
menu would change (with a breakpoint in the modal form I could see the
menu on the calling form change), but as soon as the modal form exited
the calling form's menu would revert to the original contents. I
fixed it by moving the menu modifying code to the calling form.

I never found an explanation for this behavior. It is very similar to
your experience. I can't remember now if the modal form had a private
datasession, but that could be what causes the behavior. I suspect
your application object was created outside of your form and therefore
its code runs in a different datasession.


My app consists of multiple Top-Level forms, each with its own menu.
When an event occurs in one form that makes it necessary to modify the
menus on all Top-Level forms, I wrote code to run through the active
forms and modify the menus of each.

I discovered that when modifying the menus on other forms, the menu
would be modified, but then would revert to the original contents.
.



Relevant Pages

  • Re: Pass DataSet to Modal Form
    ... You need to modify the constructor of the form so that it takes a ... > I have built a main form that creates and fills a dataset. ... > modal form and pass it one of the tables in the dataset but I don't know how ...
    (microsoft.public.dotnet.framework.windowsforms)
  • RaiseEvent fails from a Modal form
    ... Via a button on a modal form in an ActiveX dll, I trigger a RaiseEvent to be ... trapped by the app that called the dll. ... The new app's window ends up underneath the modal ...
    (microsoft.public.vb.general.discussion)
  • Re: Alt+Tab Icon with modal dialog
    ... >at which point the main app icon no longer shows up during Alt+Tab ... >set to 3-fixed dialog for the modal form. ... >modal form into the alt+tab switching window? ...
    (microsoft.public.vb.syntax)
  • Re: How to call an event on another form - C# windows forms
    ... environment, not with windows form. ... that the first form opens the sencond with ShowDialog. ... wait until the modal form closes. ... The calling form then can read this properties and populate itself. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Print to command window?
    ... The window can be hidden/restored using WIN32 calls ... with a "lazy wait" until the form was closed - i.e. simulating a modal form. ... > because they all talk about making the app a console app. ...
    (microsoft.public.vb.general.discussion)