Solved How to use GeUserArea.DrawCustomButton()


I looked at the Python SDK and could not find a detailed explanation, so let me ask two questions about DrawCustomButton().

  1. What is the 5th argument "ids" for?

  2. Is there a way to receive a message or something when I click on the button?

Here is a simple script that opens a dialog with a UserArea and draws a button.
It looks like just a rectangle is drawn, but I wish I could create an interactive button that can receive triggers with InputEvent() or Message().

Thank you!

import c4d

class MyUserArea(c4d.gui.GeUserArea):
    def DrawMsg(self, x1, y1, x2, y2, msg_ref):
        # Initializes draw region
        self.SetClippingRegion(x1, y1, x2, y2)
        self.DrawRectangle(x1, y1, x2, y2)
        # Draws black background
        self.DrawRectangle(x1, y1, x2, y2)
        # Draws a button
        self.DrawCustomButton(x=20, y=20, w=80, h=40, ids=[0], nofill=False, focus=False)

class MyDialog(c4d.gui.GeDialog):
    ua = MyUserArea()
    def CreateLayout(self):
        area = self.AddUserArea(id=0, flags=c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT)
        self.AttachUserArea(, id=area)
        return True

def main():
    dialog = MyDialog()
    dialog.Open(dlgtype=c4d.DLG_TYPE_MODAL, defaulth=200, defaultw=200)

if __name__ == '__main__':

2022-05-07 013200.png

Hello @kng_ito,

Thank you for reaching out to us. Please excuse the long radio silence from our side. Your topic had the misfortune to be posted at the beginning of our company meeting on May the 6th and was then overlooked when we collected the accumulated topics on May the 16th once the meeting was over.

I again want to apologize for this. If the topic is still relevant for you, we will be happy to answer it, but we would ask for a brief confirmation of continued relevance. Without such indication of continued relevance, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.

Thank you for your understanding,

MAXON SDK Specialist

Hi @ferdinand ,
I originally just asked out of curiosity, so no problem.
As for the topic, I would like to know the solution for when the time comes to use this gadget in the future.
Thank you.

Hi @kng_ito, I jsut checked with the original dev that implemented this function and this function should have been marked as private as Ids are not stable, so we will not communicate on them and we will fix documentation to reflect that this method is private.

With that's said I'm afraid , in any case it is not possible to automatically wire InputEvent, in a GeUserArea you have the drawing part and then it's up to you with pixel coordinate to know where the user clicked in InputEvent and then redraw your area accordingly.


Hi @m_adam ,
It is unfortunate because I thought it would be useful if it were available, but I understand.
Thank you for your prompt response!