Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    right click in dialog

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 394 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      Hey

      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]
      

      Thanks

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post