Dear Group,
Someone issued this command on menu bar
ON SELECTION BAR 2 OF mymenu do myprg

how can I retrieve the expr 'do myprg' for bar 2 of mymenu ?

TIA

Peter

Re: on selection expression by Olaf

Olaf
Mon Feb 13 07:07:12 CST 2006

Hi Peter,

"Peter" <peter@local.local> schrieb im Newsbeitrag news:uHNA0fJMGHA.2472@TK2MSFTNGP11.phx.gbl...
> Dear Group,
> Someone issued this command on menu bar
> ON SELECTION BAR 2 OF mymenu do myprg
>
> how can I retrieve the expr 'do myprg' for bar 2 of mymenu ?
It's not an expression, it's a command that is called.
It executes myprg.prg (and fails if it doesn't find myprg.prg
as standalone or compiled part of the EXE/APP file).

Bye, Olaf.



Re: on selection expression by Peter

Peter
Mon Feb 13 07:23:10 CST 2006

Dear Olaf,
sorry, I didn't explain clearly
I want to do something like this
on error do myErrorTrap && oldway
lcMyExpr = on('Error')
on error do somethingelse
** restore on error routine
on error &lcMyExpr

So for my menu bar
I want to get back the expr for do myprg, something similar to on("Selection
bar") ;-)
on selection bar 2 of mymenu do myprg
*** how to do
lcOldExpr = get back do myprg
** do something else
on selection bar 2 of mymenu
** restore it back
on selection bar 2 of mynenu &lcOldExpr

B.regards
Peter

"Olaf Doschke" <T2xhZi5Eb3NjaGtlQFNldG1pY3MuZGU@strconv.14> wrote in message
news:eKHYT7JMGHA.3496@TK2MSFTNGP14.phx.gbl...
> Hi Peter,
>
> "Peter" <peter@local.local> schrieb im Newsbeitrag
> news:uHNA0fJMGHA.2472@TK2MSFTNGP11.phx.gbl...
>> Dear Group,
>> Someone issued this command on menu bar
>> ON SELECTION BAR 2 OF mymenu do myprg
>>
>> how can I retrieve the expr 'do myprg' for bar 2 of mymenu ?
> It's not an expression, it's a command that is called.
> It executes myprg.prg (and fails if it doesn't find myprg.prg
> as standalone or compiled part of the EXE/APP file).
>
> Bye, Olaf.
>



Re: on selection expression by Dan

Dan
Mon Feb 13 10:54:28 CST 2006

There's nothing built into the language to do that.

Menus are some of the oldest constructs in the language and have changed
only trivially since the syntax was first released for dBase IV, later
cloned for Foxpro 1.0. We didn't have this ability then, and we still don't.

Dan


Peter wrote:
> Dear Olaf,
> sorry, I didn't explain clearly
> I want to do something like this
> on error do myErrorTrap && oldway
> lcMyExpr = on('Error')
> on error do somethingelse
> ** restore on error routine
> on error &lcMyExpr
>
> So for my menu bar
> I want to get back the expr for do myprg, something similar to
> on("Selection bar") ;-)
> on selection bar 2 of mymenu do myprg
> *** how to do
> lcOldExpr = get back do myprg
> ** do something else
> on selection bar 2 of mymenu
> ** restore it back
> on selection bar 2 of mynenu &lcOldExpr
>
> B.regards
> Peter
>
> "Olaf Doschke" <T2xhZi5Eb3NjaGtlQFNldG1pY3MuZGU@strconv.14> wrote in
> message news:eKHYT7JMGHA.3496@TK2MSFTNGP14.phx.gbl...
>> Hi Peter,
>>
>> "Peter" <peter@local.local> schrieb im Newsbeitrag
>> news:uHNA0fJMGHA.2472@TK2MSFTNGP11.phx.gbl...
>>> Dear Group,
>>> Someone issued this command on menu bar
>>> ON SELECTION BAR 2 OF mymenu do myprg
>>>
>>> how can I retrieve the expr 'do myprg' for bar 2 of mymenu ?
>> It's not an expression, it's a command that is called.
>> It executes myprg.prg (and fails if it doesn't find myprg.prg
>> as standalone or compiled part of the EXE/APP file).
>>
>> Bye, Olaf.



Re: on selection expression by Olaf

Olaf
Mon Feb 13 15:29:35 CST 2006

Hi Peter,

on selection does not work like on error in this repsect.
No way to read out On("Selection",nBarno) or something like that.

You may be able to define
ON SELECTION BAR 2 OF mymenu do &gcSomething

and define gcSomething as a public variable holding
whatever you want to Do with that menu bar, which
you may change at runtime. Haven't tested, if that works.

The better approach would be to have the switch within
the called program "myprog.prg" and not within the menu.

Bye, Olaf.






Re: on selection expression by Peter

Peter
Mon Feb 13 20:50:16 CST 2006

Dear Dan and Olaf,
Thank you for your replies
I searched the help file and didn't find any so I hope by asking NG will
have some ideas of what to do.
Anyway, for the time being, public variable is a workaround.
Thank you and best regards
Peter

"Dan Freeman" <spam@microsoft.com> wrote in message
news:uIIFp4LMGHA.3104@TK2MSFTNGP11.phx.gbl...
> There's nothing built into the language to do that.
>
> Menus are some of the oldest constructs in the language and have changed
> only trivially since the syntax was first released for dBase IV, later
> cloned for Foxpro 1.0. We didn't have this ability then, and we still
> don't.
>
> Dan
>
>
> Peter wrote:
>> Dear Olaf,
>> sorry, I didn't explain clearly
>> I want to do something like this
>> on error do myErrorTrap && oldway
>> lcMyExpr = on('Error')
>> on error do somethingelse
>> ** restore on error routine
>> on error &lcMyExpr
>>
>> So for my menu bar
>> I want to get back the expr for do myprg, something similar to
>> on("Selection bar") ;-)
>> on selection bar 2 of mymenu do myprg
>> *** how to do
>> lcOldExpr = get back do myprg
>> ** do something else
>> on selection bar 2 of mymenu
>> ** restore it back
>> on selection bar 2 of mynenu &lcOldExpr
>>
>> B.regards
>> Peter
>>
>> "Olaf Doschke" <T2xhZi5Eb3NjaGtlQFNldG1pY3MuZGU@strconv.14> wrote in
>> message news:eKHYT7JMGHA.3496@TK2MSFTNGP14.phx.gbl...
>>> Hi Peter,
>>>
>>> "Peter" <peter@local.local> schrieb im Newsbeitrag
>>> news:uHNA0fJMGHA.2472@TK2MSFTNGP11.phx.gbl...
>>>> Dear Group,
>>>> Someone issued this command on menu bar
>>>> ON SELECTION BAR 2 OF mymenu do myprg
>>>>
>>>> how can I retrieve the expr 'do myprg' for bar 2 of mymenu ?
>>> It's not an expression, it's a command that is called.
>>> It executes myprg.prg (and fails if it doesn't find myprg.prg
>>> as standalone or compiled part of the EXE/APP file).
>>>
>>> Bye, Olaf.
>
>