Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi,
I looked at the Python SDK and could not find a detailed explanation, so let me ask two questions about DrawCustomButton().
What is the 5th argument "ids" for?
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.OffScreenOn() self.SetClippingRegion(x1, y1, x2, y2) self.DrawRectangle(x1, y1, x2, y2) # Draws black background self.DrawSetPen(color=c4d.Vector(0)) 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(ua=self.ua, id=area) return True def main(): dialog = MyDialog() dialog.Open(dlgtype=c4d.DLG_TYPE_MODAL, defaulth=200, defaultw=200) if __name__ == '__main__': main()