Custom left right menu gedialog command function

On 13/02/2017 at 13:03, xxxxxxxx wrote:

I would like to know if it's possible to set a custom left right click menu into a gedialog when mouse is on a certain ID.

I know for doing such things we normally does this into the Message function of the gedialog but we can't know on which ID the left button is pressed.

Then for me is not a working solution.

Typically I want to do but only in one id.

Or at least I thinked something like that will work but sadly no 😕
This look like when left button is pressed, click is not evaluated so there is no control id 😕

def Message(self, msg, result) :
        res = c4d.BaseContainer()
        if msg == c4d.MSG_DESCRIPTION_COMMAND:
            id_ui = result['id'][0].id
        c4d.gui.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSERIGHT, res)
        if res[c4d.BFM_INPUT_VALUE] and id_ui == 10:
            print 'a'
            return True
        return c4d.gui.GeDialog.Message(self, msg, result)

Thanks in advance.

EDIT: I'm afraid the only way is to set a GeUserArea and doing my stuff in the message function of this GeUserArea, hope there is a workaround.

On 14/02/2017 at 02:03, xxxxxxxx wrote:


As shown in the post you link, you have to catch BFM_INPUT message in the dialog's Message() and check BFM_INPUT_CHANNEL for BFM_INPUT_MOUSERIGHT.
Then to test if the right click is on specific gadget, retrieve its position/size with GeDialog.GetItemDim() and compare these with the mouse position (BFM_INPUT_X, BFM_INPUT_X).

Note it's only possible to catch right clicks inside modal dialogs.
Also, MSG_DESCRIPTION_COMMAND is only for plugins that have a description in the Attribute Manager.

On 14/02/2017 at 07:29, xxxxxxxx wrote:

Sadly it's not applicable to me since I got a hightly dynamic UI. (custom size of bitmap / custom number of bitmap and everything are in custom number of tab which are in scroll group :p)
Then retriving the x/y for each of my bitmap will be a bit hard. I guess I will make a custom buttom or use another hotkey.

Btw is there a way for removing the default menu and having the click evaluated in the command function??

thanks you anyway

On 15/02/2017 at 04:22, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Btw is there a way for removing the default menu and having the click evaluated in the command function??

The default right-click menu can't be disabled in asynchronous dialogs.
Command() is limited to only some actions made on gadgets. Message() is more versatile.