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

    Custom left right menu gedialog command function

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 521 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 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 https://developers.maxon.net/forum/topic/7621/9561_right-click-in-dialog&PID=37702#37702 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.

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

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

        Hi,

        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.

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

          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

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

            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.

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