Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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 Contextual Menu on a Button?

    Cinema 4D SDK
    r21 python
    2
    3
    592
    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.
    • B
      bentraje
      last edited by

      Hi,

      Is there a way I can have flyout/contextual menu when I right click button?
      Currently, the default menu pops up when I do so.
      You can see the illustration of the problem here:
      https://www.dropbox.com/s/49rvo8w4qh77ozj/c4d202_rmb_contextual_menu_on_button.mp4?dl=0

      Is there a direct way of doing this? That is a parameter of the AddButton element that allows such feature. There seems to be none in the documentation, but still want to confirm.

      There is also a working code of RMB Contextual Menu on this thread. The problem is the RMB Contextual Menu is the same in all areas of the GeDialog.
      I was thinking of just isolating the function in the area of button (i.e. indirect way).
      If so, how do I determine the X,Y area of button relative to the dialog? Although of course, I'd prefer the direct way. hehehe

      Thanks for looking at my problem

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @bentraje,

        GeDialog.GetItemDim Can be used to retrieve x/y and size/height of a gadget. Of course, the dialog needs to be open, otherwise, you will get weird results.

        So if you modify the code provided in Disable default Right-Click Menu of IsPositionInGuiArea with the next one is working as expected.

            def IsPositionOnGadget(self, gadgetId, x, y):
                # Be sure that the windows is opened,
                # in our case since we call it in BFM_INTERACTSTART it's ok
                buttonData = self.GetItemDim(gadgetId)
                
                if not buttonData["x"] < x < buttonData["x"] + buttonData["w"]:
                    return False
        
                if not buttonData["y"] < y < buttonData["y"] + buttonData["h"]:
                    return False
        
                return True
        

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 2
        • B
          bentraje
          last edited by

          @m_adam

          Works as expected! Thanks again for the sample code, makes everything clear.

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