SetData() with FindCustomGui / CUSTOMGUI_BITMAPBUTTON
-
Hi there,
I'm currently having troubles to understand the workflow when using
FindCustomGui
. I'm currently relying on a Dialog created via ResEdit. Within this Dialog I have a Flushgroup where I create Buttons viaAddCustomGui
. This works totally fine and I'm able to set different settings via thec4d.BaseContainer
.However when using
FindCustomGui
I'm not sure on where I need to use:SetData()
to set for example theFORCESIZE
of the button to16
.Pseudo-Code looks like this:
bc = c4d.BaseContainer() # Create a new container to store the button image bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True) bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, iconid) bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, "tooltip") bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 16) button = self.AddCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON, "Title", c4d.BFH_MASK | c4d.BFV_CENTER, 0, 0, bc)
Works like a charm
button = self.FindCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON) # button.GetData() is None. button.SetImage(bmp, True)
Even if I create my own
c4d.BaseConainer
again and setting it viaSetData
:button = self.FindCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON) bc = c4d.BaseContainer() bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, iconid) bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, "tooltip") bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 16) button.SetData(bc) # After button.SetData(bc) button.GetData() is still None..! button.SetImage(bmp, True)
This would really save me a lot of pain flushing manually different groups for those bitmapbuttons... Any ideas? What am I doing wrong?
Cheers,
Lasse -
Hello,
please use the forum features by setting your thread to a question :
Q&A New Functionality.There's a bit of confusion here.
You got two things, the data and the UI.- When you set your BaseContainer and use it to add a customgui, that basecontainer will be used by the ui.
- If you use SetData you are defining the data of the parameter.
For that reason, your last snippet will not work at all.
You want to change the description of the button. The only way is to flush the group and recreate it with new parameters (size).
Cheers,
Manuel -
Thanks, for the answer Manuel. (And sorry about not setting it as a question...)
Just to make sure, there's no way to flush a single Element and insert at that position, right? It has to be a group?
Thanks,
Lasse -
@lasselauch said in SetData() with FindCustomGui / CUSTOMGUI_BITMAPBUTTON:
there's no way to flush a single Element and insert at that position, right? It has to be a group
For what I know, correct.
Cheers,
Manuel