find clicked menu

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

find clicked menu

Post by davoodice2 »

hi.
in bone select pop up dialog how to find witch menu is clicked?

for these menus
target
angle control bone
position control bone
scale control bone

if target menu clicked do something
but if position control menu clicked do something other



I work on im_select_bone
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: find clicked menu

Post by hayasidist »

davoodice2 wrote: Sun Sep 05, 2021 8:54 am in bone select pop up dialog how to find witch menu is clicked?
The UI is built from various base widgets e.g. TextControl https://mohoscripting.com/methods/395 and in each there's a reference to "msg" - and that's what's sent to HandleMessage(moho, view, msg) (see https://mohoscripting.com/script_structure). Convention demands use of message numbers as some positive offset from MOHO.MSG_BASE

to answer your specific question about select bone: take a look the code (C:\Program Files\Moho\Resources\Support\Scripts\Tool\lm_select_bone.lua)
User avatar
synthsin75
Posts: 9981
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: find clicked menu

Post by synthsin75 »

Since a popup menu itself doesn't send a message, just clicking on one cannot be detected. You can only detect when one of it's options has been selected.
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: find clicked menu

Post by davoodice2 »

synthsin75 wrote: Sun Sep 05, 2021 11:15 am Since a popup menu itself doesn't send a message, just clicking on one cannot be detected. You can only detect when one of it's options has been selected.
its true. but I detect that by change msg for each menu when MOHO.BuildBoneChoiceMenu
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
synthsin75
Posts: 9981
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: find clicked menu

Post by synthsin75 »

davoodice2 wrote: Sun Sep 05, 2021 12:06 pm
synthsin75 wrote: Sun Sep 05, 2021 11:15 am Since a popup menu itself doesn't send a message, just clicking on one cannot be detected. You can only detect when one of it's options has been selected.
its true. but I detect that by change msg for each menu when MOHO.BuildBoneChoiceMenu
Cool, you solved your own problem.
Post Reply