Re: Cut and Paste programming problem
- From: Jack Jackson <jacknospam@xxxxxxxxxxxxxxx>
- Date: Mon, 26 Nov 2007 08:19:19 -0800
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.
.
- Follow-Ups:
- Re: Cut and Paste programming problem
- From: Dan Freeman
- Re: Cut and Paste programming problem
- References:
- Cut and Paste programming problem
- From: dougrhoughton
- Re: Cut and Paste programming problem
- From: Fred Taylor
- Re: Cut and Paste programming problem
- From: Gene Wirchenko
- Re: Cut and Paste programming problem
- From: Fred Taylor
- Re: Cut and Paste programming problem
- From: Gene Wirchenko
- Cut and Paste programming problem
- Prev by Date: Re: Cut and Paste programming problem
- Next by Date: Re: Project manager doesn't recognize preprocessor constants
- Previous by thread: Re: Cut and Paste programming problem
- Next by thread: Re: Cut and Paste programming problem
- Index(es):
Relevant Pages
|