right click in dialog

  • On 21/12/2013 at 07:37, xxxxxxxx wrote:


    Is it possible to get the right click in a dialog and replace the default menu with an own or an function ?

    I try the this without success

    def Command(self, id_, msg) :
            print msg[c4d.BFM_ACTION_DP_MENUCLICK]


  • On 25/12/2013 at 09:30, xxxxxxxx wrote:

    Hi, Command(...) is called for gadgets. For everything else take a look at Message(...).

    import c4d
    from c4d import gui

    class MyDialog(c4d.gui.GeDialog) :
        def Message(self, msg, result) :
            if msg.GetId() == c4d.BFM_INPUT:
                 if msg.GetLong(c4d.BFM_INPUT_CHANNEL)==c4d.BFM_INPUT_MOUSERIGHT:
                     # put in your code which will be executed on right mouse click
                     menu = c4d.BaseContainer()
                     menu.SetString(1000, 'Item 1')
                     menu.SetString(1001, 'Item 2')
                     menu.SetString(0, "")                # Append separator
                     menu.SetString(1003, 'Item 2')
                     result = c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=c4d.MOUSEPOS, y=c4d.MOUSEPOS)
                     return True # don't route message to window parents
            return c4d.gui.GeDialog.Message(self, msg, msg)

    Cheers, s_rath

Log in to reply