SOLVED Make Button Invisible And Still Occupies Space?


Is there a way I can make a button invisible and still occupies space.
My main reason is that I want only FK controls to be visible when in FK mode and IK controls to be visible in IK mode.

You can see the illustration of the problem here:

Another alternative I have is to implement a FlushGroup but I don't like it since I have to maintain different sets of UI.
I just want a single one and make buttons invisible as needed.

Is there a way around this?

Quick way could be:

Setting GeDialog.Enable to False and depending on your Button changing the background color to transparent..?!


what exactly do you mean with "button"?

A standard button (AddButton()), a bitmap button or a custom GeUserArea based gadget?

@lasselauch 's idea to use Enable() is, I guess, the easiest way to achieve what you want. But what is the overall behaviour of your dialog? Is the user able to resize it; can the width or height or your GUI elements changes based on resizing the dialog? Do your UI elements have a minimum or fixed size?

If the element has fixed size, you can insert an empty static text element with the desired dimensions in place of the original element when rebuilding your layout.

self.AddStaticText(999,c4d.BFH_LEFT | c4d.BFV_TOP, c4d.gui.SizePix(100), c4d.gui.SizePix(100))

best wishes,

@lasselauch and @s_bach

Thanks for the response. Apologies for the late response.

RE: what exactly do you mean with "button"?
Referring to the image link provided, it couldn't be AddButton so the Enable will not work on this one. As the Enable, correct me if I'm wrong, will just gray out the button. I want it to be invisible.

It is a CustomGui BitmapButton.

RE: you can insert an empty static text element
That's the alternative I was thinking with the FlushGroup. Basically two groups. One specific to IK and the other specific to FK mode.

But again, I just want a single one and make buttons invisible as needed.

Is this still possible?

If you are using a BitmapButtonCustomGui, you could simply change the image the bitmap button is displaying. E.g. use an image filled with the background color.

I don't know why you think you need two groups.

You can simply have one group that you flush and re-fill on demand. In that re-fill, you can replace anything with that static text placeholder as shown above:


flags = c4d.BFH_LEFT | c4d.BFV_TOP
width = c4d.gui.SizePix(100)
height = c4d.gui.SizePix(100)

if self.mode == True:
    # add bitmap button
    settings = c4d.BaseContainer()
    settings.SetBool(c4d.BITMAPBUTTON_BUTTON, False)

    bitmapButtonGUI = self.AddCustomGui(1001, c4d.CUSTOMGUI_BITMAPBUTTON, "", flags, width, height, settings)

    if bitmapButtonGUI is not None:
        icon = c4d.gui.GetIcon(c4d.Ocube)
        bmp = icon["bmp"]
        subBitmap = c4d.bitmaps.BaseBitmap()
        bmp.CopyPartTo(subBitmap, icon["x"], icon["y"], icon["w"], icon["h"] )
        bitmapButtonGUI.SetImage(subBitmap, True, False)

    # add placeholder with the size of the bitmap button
    self.AddStaticText(999, flags, width, height)


best wishes,

@PluginStudent @s_bach

Thank you for the response. Both works as expected.

RE: don't know why you think you need two groups.
Just for reference, I was thinking of this logic

if self.mode == True:

Anyhow, no further action required :)