For years, my app has set up its menu and then gone merrily
along. I now want to have the menu configurable. How do I get the
old menuing tossed?

If I restart the program after the configuration change, it
works. It does not work when I rerun my menu setup code. (The code
is executed, and I temporarily see the changes, but when I am back at
the read events, the menu is back to as it was before my attempted
change.)

I have tried set sysmenu to default, set sysmenu nosave, release
pad all, and release menus, but none have worked.

My basic pattern is
set sysmenu automatic
set sysmenu to _medit
<define pads>
<define bars>

How do I have to modify this so that the menu is reconfigured on
subsequent runs?

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Gene

Gene
Tue Jan 09 15:14:09 CST 2007

Gene Wirchenko <genew@ocis.net> wrote:

> For years, my app has set up its menu and then gone merrily
>along. I now want to have the menu configurable. How do I get the
>old menuing tossed?
>
> If I restart the program after the configuration change, it
>works. It does not work when I rerun my menu setup code. (The code
>is executed, and I temporarily see the changes, but when I am back at
>the read events, the menu is back to as it was before my attempted
>change.)

A minor refinement to this: When execution returns to the level
above where the menu setup call was, the menu resets. It appears that
there is some scoping rule in effect, but I see nothing about that
documented.

> I have tried set sysmenu to default, set sysmenu nosave, release
>pad all, and release menus, but none have worked.

I have tried a few more commands since: clear menus and
reordering various commands. None work: the menu keeps reverting.

> My basic pattern is
> set sysmenu automatic
> set sysmenu to _medit
> <define pads>
> <define bars>
>
> How do I have to modify this so that the menu is reconfigured on
>subsequent runs?

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Bernhard

Bernhard
Wed Jan 10 06:05:00 CST 2007

Hi Gene,

> A minor refinement to this: When execution returns to the level
> above where the menu setup call was, the menu resets. It appears that
> there is some scoping rule in effect, but I see nothing about that
> documented.
I don't know of any scoping rules for menues. But I can think of 2 ways to
return to some previous state.
One is by PUSH MENU / POP MENU.
The other way: there is some code which runs automatically (like .Activate)
which calls again the previous construction of the menu.
It seems to me, you don't use PUSH / POP MENU.
To find out about the second way, set breakpoints on some prmbar / prmpad /
cntbar / cntpad in the debugger.

Regards
Bernhard Sander

Re: Resetting a Menu by Gene

Gene
Wed Jan 10 19:24:52 CST 2007

Bernhard Sander <fuchs@no.spam> wrote:

>> A minor refinement to this: When execution returns to the level
>> above where the menu setup call was, the menu resets. It appears that
>> there is some scoping rule in effect, but I see nothing about that
>> documented.

>I don't know of any scoping rules for menues. But I can think of 2 ways to
>return to some previous state.

I do not want to return to a previous state. I want to change
the menu.

>One is by PUSH MENU / POP MENU.
>The other way: there is some code which runs automatically (like .Activate)
>which calls again the previous construction of the menu.
>It seems to me, you don't use PUSH / POP MENU.
>To find out about the second way, set breakpoints on some prmbar / prmpad /
>cntbar / cntpad in the debugger.

There is no such code. I have already already run it through the
debugger. A return gets executed, and I lose the new menu changes. It
is very frustrating as none of the documentation I have indicates
anything of this sort of problem.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Jack

Jack
Wed Jan 10 23:25:55 CST 2007

On Fri, 05 Jan 2007 10:11:10 -0800, Gene Wirchenko <genew@ocis.net>
wrote:

> For years, my app has set up its menu and then gone merrily
>along. I now want to have the menu configurable. How do I get the
>old menuing tossed?
>
> If I restart the program after the configuration change, it
>works. It does not work when I rerun my menu setup code. (The code
>is executed, and I temporarily see the changes, but when I am back at
>the read events, the menu is back to as it was before my attempted
>change.)
>
> I have tried set sysmenu to default, set sysmenu nosave, release
>pad all, and release menus, but none have worked.
>
> My basic pattern is
> set sysmenu automatic
> set sysmenu to _medit
> <define pads>
> <define bars>
>

This probably isn't applicable to your situation, but I will describe
my problem with menu changes not sticking.

I have a Top-Level form with a menu. From that form I call a modal
form (DO FORM xxx WITH Thisform). The second form modifies the menu
on the first form. As long as I stay in the second form I see the
changes to the first form's menu. As soon as the second form exits
the menu reverts back to what it was before the changes.

I was unable to make the changes stick, so I now make the changes
after the second form returns and that works fine.

Re: Resetting a Menu by Gene

Gene
Thu Jan 11 11:48:41 CST 2007

Jack Jackson <jacknospam@pebbleridge.com> wrote:

>On Fri, 05 Jan 2007 10:11:10 -0800, Gene Wirchenko <genew@ocis.net>
>wrote:
>
>> For years, my app has set up its menu and then gone merrily
>>along. I now want to have the menu configurable. How do I get the
>>old menuing tossed?
>>
>> If I restart the program after the configuration change, it
>>works. It does not work when I rerun my menu setup code. (The code
>>is executed, and I temporarily see the changes, but when I am back at
>>the read events, the menu is back to as it was before my attempted
>>change.)
>>
>> I have tried set sysmenu to default, set sysmenu nosave, release
>>pad all, and release menus, but none have worked.
>>
>> My basic pattern is
>> set sysmenu automatic
>> set sysmenu to _medit
>> <define pads>
>> <define bars>

>This probably isn't applicable to your situation, but I will describe
>my problem with menu changes not sticking.

It appears to be exactly the same situation that I am running
into. Unfortunately, the no-stick issue with menus is not documented
anywhere that I have seen.

>I have a Top-Level form with a menu. From that form I call a modal
>form (DO FORM xxx WITH Thisform). The second form modifies the menu
>on the first form. As long as I stay in the second form I see the
>changes to the first form's menu. As soon as the second form exits
>the menu reverts back to what it was before the changes.
>
>I was unable to make the changes stick, so I now make the changes
>after the second form returns and that works fine.

My setup is a bit different. Formerly, I set up the menu in my
main program before read events. That worked fine, because the menu
stayed constant. Now that it needs to be modifiable from a form, this
is no longer workable.

I changed my code so that my menu setup code is inside my
application object so it could be called from other places. The first
time, the menu setup sticks. After that, any change does not as soon
as where the menu setup call is returns.

I have considered reverting my menu setup code to the main
program and having any program that changes the setting set a global
and clear events. In the main program, I would set the menu up again
and read events. This is an ugly kludge and will not work right if
there is another form open.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Bernhard

Bernhard
Thu Jan 11 12:47:51 CST 2007

Hi Gene,

the foxpro menues behave quite often in a manner one would not expect. This
arises from the fact, that the menues are not object based and that there is no
scoping for any menu item.
I also had a number of problems (though they were different from yours). Then I
changed the defining programs (at least for the popups), so that they can be
called from form.activate (what can happen quite often and in moments, where one
does not think it is necessary to redefine the menu). Since then a lot of the
problems went away.
This looks a little like your attempt to revert the menu setup code to the main
program, but it avoids your additional CLEAR EVENTS / READ EVENTS.
It is no problem, to redefine existing pads and bars at any time, even if they
have the same characteristics as before.

Regards
Bernhard Sander

Re: Resetting a Menu by Gene

Gene
Thu Jan 11 14:41:34 CST 2007

Bernhard Sander <fuchs@no.spam> wrote:

>the foxpro menues behave quite often in a manner one would not expect. This
>arises from the fact, that the menues are not object based and that there is no
>scoping for any menu item.

The problem I am running into is as if menus themselves do have
scope.

>I also had a number of problems (though they were different from yours). Then I
>changed the defining programs (at least for the popups), so that they can be
>called from form.activate (what can happen quite often and in moments, where one
>does not think it is necessary to redefine the menu). Since then a lot of the
>problems went away.

I have but one menu in my system. Depending on some
configuration changes, I want to be able to change the menu. Because
of the problem that I am having, I can not update the menu when the
configuaration changes. If the user restarts the program, the changes
take effect, but this is not as good as it should be. I want the
changes to take effect right away.

Which form's .activate? This is my menu menu for starting
various programs, mostly forms.

>This looks a little like your attempt to revert the menu setup code to the main
>program, but it avoids your additional CLEAR EVENTS / READ EVENTS.
>It is no problem, to redefine existing pads and bars at any time, even if they
>have the same characteristics as before.

I have not run into VFP errors, just that the menu change does
not take.

Could someone please post some code? A menu that can be
configured from within a form but that sticks for all forms? I have a
feeling that it is a minor thing that I have no reason, a priori, to
suppose that that is it. (A fancy way of saying design kludge.)

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Bernhard

Bernhard
Thu Jan 11 15:44:00 CST 2007

Hi Gene,

have a look at the IN WINDOW ... and IN SCREEN clauses of DEFINE POPUP.

Regards
Bernhard Sander

Re: Resetting a Menu by Gene

Gene
Thu Jan 11 16:02:59 CST 2007

Bernhard Sander <fuchs@no.spam> wrote:

>have a look at the IN WINDOW ... and IN SCREEN clauses of DEFINE POPUP.

I did try in screen to no avail.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Bernhard

Bernhard
Fri Jan 12 04:35:07 CST 2007

Hi Gene,

>>have a look at the IN WINDOW ... and IN SCREEN clauses of DEFINE POPUP.
> I did try in screen to no avail.
Then I don't know. I use several menus and change pads and bars at runtime
without such problems.

Regards
Bernhard Sander

Re: Resetting a Menu by Gene

Gene
Fri Jan 12 16:57:56 CST 2007

Bernhard Sander <fuchs@no.spam> wrote:

>Hi Gene,
>
>>>have a look at the IN WINDOW ... and IN SCREEN clauses of DEFINE POPUP.
>> I did try in screen to no avail.
>Then I don't know. I use several menus and change pads and bars at runtime
>without such problems.

Could you please post some code?

I am stuck in do-not-know either, in a more uncomfortable
version.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Resetting a Menu by Imaginecorp

Imaginecorp
Sat Jan 13 09:07:11 CST 2007

Hello Gene:
Here is how you do it

***Initial Setup Menu
Set sysmenu to
set sysmenu automatic
Define Pad its_file of _mysysmenu prompt "\<File" color scheme 3
***applicable code
Define Pad its_View of _mysysmenu prompt "\<View" color scheme 3
***applicable code
***** other pads
On pad its_file of _mysysmenu activate popup itsfile

Define popup itsfile .......&&applicable code here
**** itsfile choices
*****************************************
Now in the form or program that you want to reconfigure the menu:
*****************************************
***changemenu()
Release Pad its_file of _mysysmenu
Release popups itsfile extended
Define Pad its_file of _mysysmenu Before its_view prompt "\<File" color
scheme 3
***applicable code
Define popup itsfile margin **** etc etc
**** New choices for itsfile

This Menu will stick once changed throughout the app unless rechanged
You could use a Docase...endcase to display various configurations based
upon user choice etc

If you want to revert to the old menu use POP and PUSH instead Release

--
Mohammed
www.imaginecorp.com/what_we_do.htm

"Gene Wirchenko" <genew@ocis.net> wrote in message
news:bd3tp2daa407vrhp5c2hg45dk7a9fm0sif@4ax.com...
> For years, my app has set up its menu and then gone merrily
> along. I now want to have the menu configurable. How do I get the
> old menuing tossed?
>
> If I restart the program after the configuration change, it
> works. It does not work when I rerun my menu setup code. (The code
> is executed, and I temporarily see the changes, but when I am back at
> the read events, the menu is back to as it was before my attempted
> change.)
>
> I have tried set sysmenu to default, set sysmenu nosave, release
> pad all, and release menus, but none have worked.
>
> My basic pattern is
> set sysmenu automatic
> set sysmenu to _medit
> <define pads>
> <define bars>
>
> How do I have to modify this so that the menu is reconfigured on
> subsequent runs?
>
> Sincerely,
>
> Gene Wirchenko
>
> Computerese Irregular Verb Conjugation:
> I have preferences.
> You have biases.
> He/She has prejudices.



Re: Resetting a Menu by Imaginecorp

Imaginecorp
Sat Jan 13 09:17:51 CST 2007

Sorry forget to set action with:

On pad its_file of _mysysmenu activate popup itsfile

in the Changemenu() after Define Pad
--
Mohammed
www.imaginecorp.com/what_we_do.htm



"Imaginecorp" <imaginecorp@msn.com> wrote in message
news:e8nA8RyNHHA.320@TK2MSFTNGP06.phx.gbl...
> Hello Gene:
> Here is how you do it
>
> ***Initial Setup Menu
> Set sysmenu to
> set sysmenu automatic
> Define Pad its_file of _mysysmenu prompt "\<File" color scheme 3
> ***applicable code
> Define Pad its_View of _mysysmenu prompt "\<View" color scheme 3
> ***applicable code
> ***** other pads
> On pad its_file of _mysysmenu activate popup itsfile
>
> Define popup itsfile .......&&applicable code here
> **** itsfile choices
> *****************************************
> Now in the form or program that you want to reconfigure the menu:
> *****************************************
> ***changemenu()
> Release Pad its_file of _mysysmenu
> Release popups itsfile extended
> Define Pad its_file of _mysysmenu Before its_view prompt "\<File" color
> scheme 3
> ***applicable code
> Define popup itsfile margin **** etc etc
> **** New choices for itsfile
>
> This Menu will stick once changed throughout the app unless rechanged
> You could use a Docase...endcase to display various configurations based
> upon user choice etc
>
> If you want to revert to the old menu use POP and PUSH instead Release
>
> --
> Mohammed
> www.imaginecorp.com/what_we_do.htm
>
> "Gene Wirchenko" <genew@ocis.net> wrote in message
> news:bd3tp2daa407vrhp5c2hg45dk7a9fm0sif@4ax.com...
>> For years, my app has set up its menu and then gone merrily
>> along. I now want to have the menu configurable. How do I get the
>> old menuing tossed?
>>
>> If I restart the program after the configuration change, it
>> works. It does not work when I rerun my menu setup code. (The code
>> is executed, and I temporarily see the changes, but when I am back at
>> the read events, the menu is back to as it was before my attempted
>> change.)
>>
>> I have tried set sysmenu to default, set sysmenu nosave, release
>> pad all, and release menus, but none have worked.
>>
>> My basic pattern is
>> set sysmenu automatic
>> set sysmenu to _medit
>> <define pads>
>> <define bars>
>>
>> How do I have to modify this so that the menu is reconfigured on
>> subsequent runs?
>>
>> Sincerely,
>>
>> Gene Wirchenko
>>
>> Computerese Irregular Verb Conjugation:
>> I have preferences.
>> You have biases.
>> He/She has prejudices.
>
>



Re: Resetting a Menu by Imaginecorp

Imaginecorp
Sat Jan 13 09:23:48 CST 2007

I am losing it
Do not forget a
_SCREEN.REFRESH
--
Mohammed
www.imaginecorp.com/what_we_do.htm

"Imaginecorp" <imaginecorp@msn.com> wrote in message
news:%23i5g5XyNHHA.3668@TK2MSFTNGP02.phx.gbl...
> Sorry forget to set action with:
>
> On pad its_file of _mysysmenu activate popup itsfile
>
> in the Changemenu() after Define Pad
> --
> Mohammed
> www.imaginecorp.com/what_we_do.htm
>
>
>
> "Imaginecorp" <imaginecorp@msn.com> wrote in message
> news:e8nA8RyNHHA.320@TK2MSFTNGP06.phx.gbl...
>> Hello Gene:
>> Here is how you do it
>>
>> ***Initial Setup Menu
>> Set sysmenu to
>> set sysmenu automatic
>> Define Pad its_file of _mysysmenu prompt "\<File" color scheme 3
>> ***applicable code
>> Define Pad its_View of _mysysmenu prompt "\<View" color scheme 3
>> ***applicable code
>> ***** other pads
>> On pad its_file of _mysysmenu activate popup itsfile
>>
>> Define popup itsfile .......&&applicable code here
>> **** itsfile choices
>> *****************************************
>> Now in the form or program that you want to reconfigure the menu:
>> *****************************************
>> ***changemenu()
>> Release Pad its_file of _mysysmenu
>> Release popups itsfile extended
>> Define Pad its_file of _mysysmenu Before its_view prompt "\<File" color
>> scheme 3
>> ***applicable code
>> Define popup itsfile margin **** etc etc
>> **** New choices for itsfile
>>
>> This Menu will stick once changed throughout the app unless rechanged
>> You could use a Docase...endcase to display various configurations based
>> upon user choice etc
>>
>> If you want to revert to the old menu use POP and PUSH instead Release
>>
>> --
>> Mohammed
>> www.imaginecorp.com/what_we_do.htm
>>
>> "Gene Wirchenko" <genew@ocis.net> wrote in message
>> news:bd3tp2daa407vrhp5c2hg45dk7a9fm0sif@4ax.com...
>>> For years, my app has set up its menu and then gone merrily
>>> along. I now want to have the menu configurable. How do I get the
>>> old menuing tossed?
>>>
>>> If I restart the program after the configuration change, it
>>> works. It does not work when I rerun my menu setup code. (The code
>>> is executed, and I temporarily see the changes, but when I am back at
>>> the read events, the menu is back to as it was before my attempted
>>> change.)
>>>
>>> I have tried set sysmenu to default, set sysmenu nosave, release
>>> pad all, and release menus, but none have worked.
>>>
>>> My basic pattern is
>>> set sysmenu automatic
>>> set sysmenu to _medit
>>> <define pads>
>>> <define bars>
>>>
>>> How do I have to modify this so that the menu is reconfigured on
>>> subsequent runs?
>>>
>>> Sincerely,
>>>
>>> Gene Wirchenko
>>>
>>> Computerese Irregular Verb Conjugation:
>>> I have preferences.
>>> You have biases.
>>> He/She has prejudices.
>>
>>
>
>



Re: Resetting a Menu by Bernhard

Bernhard
Sat Jan 13 09:39:18 CST 2007

Hi Gene

> Could you please post some code?
here some extracts from my prgs and vcxs. Don't mind german names:

###########
this happens, if one moves around in an items grid of an invoice:

* in grid.AfterRowColumnChange:
thisform.mMenuErgaenzen_

* in Form.mMenuErgaenzen_:
DEFINE POPUP (m.lcPopGeheZu) MARGIN RELATIVE

* followed by several DEFINE BAR in several methods
* scattered over several levels of inheritance:
DEFINE BAR m.lnBar OF (m.lcPopGeheZu) ;
PROMPT m.tcPrompt + " " + m.lcZielNr ;
PICTURE m.tcBMP
ON SELECTION BAR m.lnBar OF (m.lcPopGeheZu) &lcBefehl

* and finally
ON SELECTION PAD padGeheZu OF (thisform.cID)
ON PAD padGeheZu OF (thisform.cID) ACTIVATE POPUP (m.lcPopGeheZu)

The form is a top level form. In this form lives a main menu (DEFINE MENU .. IN
WINDOW ..), its name is stored in thisform.cID

#############
this happens, if on switches to some edit mode:

DEFINE BAR knBarPosBea OF (m.lcPopPos) ;
PROMPT "\<Bearbeiten" ;
KEY CTRL+F3, "Strg+F3" ;
PICTURE "bilder\PositionenBearbeiten.bmp"

SET SKIP OF BAR knBarPosBea OF (m.lcPopPos) !m.llStatus

RELEASE BAR knBarPosESC OF (m.lcPopPos)
RELEASE BAR knBarPosESCStr OF (m.lcPopPos)

SET SKIP OF PAD padSatz OF (thisform.cID) .F.


Regards
Bernhard Sander