doMenu

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

doMenu

Mike Kerner via use-livecode
Is it possible to send a *doMenu* command to a menu item several levels
down?

Such as *Object/New Control/Radio Button* ?

Richmond.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode

> 10. jul. 2018 kl. 10:43 skrev Richmond via use-livecode <[hidden email]>:
>
> Is it possible to send a *doMenu* command to a menu item several levels down?
>
> Such as *Object/New Control/Radio Button* ?
>
> Richmond.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

I cannot answer your question about the sending of doMenu to items in a hierarchy, but this seems to me to be a situation where you would be better off placing the actual handler for what you would like to do in the stack script. Then all it takes is a call to this handler, be it from the menu item or from somewhere else. This way you do not need to send a doMenu command at all. This is how I teach my students to structure their code.

Regards
Tore Nilsen
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode
Thanks Tore,

This is alright if one knows what the actual handler sparked by the menu
item is.

on mouseUp
    set the style of the templateGraphic to polygon
    create graphic "zzz"
    set the points of grc "zzz" to fld "PTZ"
end mouseUp

Richmond.

On 10/7/2018 12:07 pm, Tore Nilsen via use-livecode wrote:

>> 10. jul. 2018 kl. 10:43 skrev Richmond via use-livecode <[hidden email]>:
>>
>> Is it possible to send a *doMenu* command to a menu item several levels down?
>>
>> Such as *Object/New Control/Radio Button* ?
>>
>> Richmond.
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> I cannot answer your question about the sending of doMenu to items in a hierarchy, but this seems to me to be a situation where you would be better off placing the actual handler for what you would like to do in the stack script. Then all it takes is a call to this handler, be it from the menu item or from somewhere else. This way you do not need to send a doMenu command at all. This is how I teach my students to structure their code.
>
> Regards
> Tore Nilsen
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode
If you are writing all of the code yourself, then it should not be a problem knowing what the handler sparked by the menu item should do.Here is how I teach my students to structure their code when they want the user to be able to perform the same action from various controls:

In the stack script:

on makeNewGraphic
  set the style of the templateGraphic to polygon
  create graphic "zzz"
  set the points of grc «zzz" to fld "PTZ"
end makeNewGraphic


Script in the button:

on mouseUp
    makeNewGraphic
end mouseUp


Script in the menu:

on menuPick pItem
  switch pItem
    case «Make new graphic»
        makeNewGraphic
        break
    default  #or other cases
        Do something else
        break
end menuPick

This way you only need to know what you would like the button or the menu item to do, and call the appropriate handler for this.

Regards
Tore


> 10. jul. 2018 kl. 12:32 skrev Richmond Mathewson via use-livecode <[hidden email]>:
>
> Thanks Tore,
>
> This is alright if one knows what the actual handler sparked by the menu item is.
>
> on mouseUp
>   set the style of the templateGraphic to polygon
>   create graphic "zzz"
>   set the points of grc "zzz" to fld "PTZ"
> end mouseUp
>
> Richmond.
>
> On 10/7/2018 12:07 pm, Tore Nilsen via use-livecode wrote:
>>> 10. jul. 2018 kl. 10:43 skrev Richmond via use-livecode <[hidden email]>:
>>>
>>> Is it possible to send a *doMenu* command to a menu item several levels down?
>>>
>>> Such as *Object/New Control/Radio Button* ?
>>>
>>> Richmond.
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> I cannot answer your question about the sending of doMenu to items in a hierarchy, but this seems to me to be a situation where you would be better off placing the actual handler for what you would like to do in the stack script. Then all it takes is a call to this handler, be it from the menu item or from somewhere else. This way you do not need to send a doMenu command at all. This is how I teach my students to structure their code.
>>
>> Regards
>> Tore Nilsen
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
Hi.

I would go to the forums and read this all the way to the end:

doMenu not finding the menu
<http://forums.livecode.com/viewtopic.php?f=7&t=30802&hilit=domenu#p165533>  

Craig Newman



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
I agree Tor. The problem with doMenu is, what happens when you want to create your own menu group? None of the doMenu calls to the standard menus will work anymore.

Bob S


> On Jul 10, 2018, at 02:07 , Tore Nilsen via use-livecode <[hidden email]> wrote:
>
> I cannot answer your question about the sending of doMenu to items in a hierarchy, but this seems to me to be a situation where you would be better off placing the actual handler for what you would like to do in the stack script. Then all it takes is a call to this handler, be it from the menu item or from somewhere else. This way you do not need to send a doMenu command at all. This is how I teach my students to structure their code.
>
> Regards
> Tore Nilsen


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
What do the open and closing double angle brackets do?

For nested menus, in a custom File menu script:

case "New|Stack"

Bob S


> On Jul 10, 2018, at 03:50 , Tore Nilsen via use-livecode <[hidden email]> wrote:
>
>    case «Make new graphic»

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: doMenu

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
Tore even.

> On Jul 10, 2018, at 07:46 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> I agree Tor.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode