<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[GUI Bitmap Button Properties]]></title><description><![CDATA[<p dir="auto">Hello everyone!<br />
I have a few questions.<br />
<img src="/forum/assets/uploads/files/1707165453655-3e1e6afb-bdbd-4efa-bc65-f0019ec99755-image.png" alt="3e1e6afb-bdbd-4efa-bc65-f0019ec99755-image.png" class=" img-fluid img-markdown" /></p>
<ul>
<li>How to remove padding between buttons?</li>
<li>How to change BITMAPBUTTON_BACKCOLOR via the Command? (When pressing on it)</li>
<li>How to activate fading fading when the back color is activated?</li>
</ul>
<pre><code>import c4d

class test_dialog(c4d.gui.GeDialog):

    def CreateLayout(self):


        self.GroupBegin(id=0, flags=c4d.BFH_SCALEFIT, rows=1, title=" ", cols=2, groupflags=0)

        bc = c4d.BaseContainer()
        bc[c4d.BITMAPBUTTON_BUTTON] = True
        bc[c4d.BITMAPBUTTON_ICONID1] = c4d.Ocube
        bc[c4d.BITMAPBUTTON_BACKCOLOR] = c4d.COLOR_BG_PALETTE
        bc[c4d.BITMAPBUTTON_DISABLE_FADING] = False
        self.bitmapButton = self.AddCustomGui(100001,
                                              c4d.CUSTOMGUI_BITMAPBUTTON, "",
                                              c4d.BFH_CENTER | c4d.BFV_CENTER,
                                              0, 0, bc)


        bc = c4d.BaseContainer()
        bc[c4d.BITMAPBUTTON_BUTTON] = True
        bc[c4d.BITMAPBUTTON_ICONID1] = c4d.Osphere
        bc[c4d.BITMAPBUTTON_BACKCOLOR] = c4d.COLOR_BG_PALETTE
        bc[c4d.BITMAPBUTTON_DISABLE_FADING] = False
        self.bitmapButton = self.AddCustomGui(100002,
                                              c4d.CUSTOMGUI_BITMAPBUTTON, "",
                                              c4d.BFH_CENTER | c4d.BFV_CENTER,
                                              0, 0, bc)

        return True


    def Command(self, id, msg):


        if id == 100001:
            print("Click Detected")
            #Change  BITMAPBUTTON_BACKCOLOR

        return True


def main():
    global dialog
    dialog = test_dialog()
    dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, defaultw=-2, defaulth=-2)


if __name__ == '__main__':
    main()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/topic/15365/gui-bitmap-button-properties</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 15:02:10 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/15365.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Feb 2024 20:38:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GUI Bitmap Button Properties on Tue, 06 Feb 2024 11:38:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/merkvilson">@<bdi>merkvilson</bdi></a> said in <a href="/forum/post/73707">GUI Bitmap Button Properties</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a> said in <a href="/forum/post/73705">GUI Bitmap Button Properties</a>:</p>
<blockquote>
<p dir="auto">How to change BITMAPBUTTON_BACKCOLOR via the Command?</p>
<p dir="auto">I am not sure if I am understanding your question here correctly. You want to change the background color of a button after CreateLayout ran? That is not possible. You can flush layout groups and rebuild them at runtime (with buttons with a new color for example). I showed here once the pattern of a dynamic dialog.</p>
</blockquote>
<p dir="auto">Is it possible to change the background color based on the toggle state?</p>
<p dir="auto">Thanks for your answers!</p>
</blockquote>
<p dir="auto">It depends on how you define <em>'possible'</em>. Dialogs in itself are static GUIs, you cannot change any of the settings you have set in <code>CreateLayout</code> after the method ran. It does not matter if it is the spacing of a group, the width of a text field, or the background color of a bitmap toggle button.</p>
<p dir="auto">What you can do in addition to defining the 2nd icon of the toggle button, is flush a layout group and then rebuild that group with a button which has the color you like. So, you wrap all your buttons in a group, and whenever a button is toggled on or off, you change a color in an array of button colors and then flush the buttons and rebuild them using your array of colors to set the background colors (and you also have to reapply the states then). The posting I linked to in my previous example lines out the details of how to do such dynamic dialog GUIs.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
]]></description><link>http://developers.maxon.net/forum/post/73708</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73708</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Tue, 06 Feb 2024 11:38:33 GMT</pubDate></item><item><title><![CDATA[Reply to GUI Bitmap Button Properties on Tue, 06 Feb 2024 11:28:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a> said in <a href="/forum/post/73705">GUI Bitmap Button Properties</a>:</p>
<blockquote>
<p dir="auto">How to change BITMAPBUTTON_BACKCOLOR via the Command?</p>
<p dir="auto">I am not sure if I am understanding your question here correctly. You want to change the background color of a button after CreateLayout ran? That is not possible. You can flush layout groups and rebuild them at runtime (with buttons with a new color for example). I showed here once the pattern of a dynamic dialog.</p>
</blockquote>
<p dir="auto">Is it possible to change the background color based on the toggle state?</p>
<p dir="auto">Thanks for your answers!</p>
]]></description><link>http://developers.maxon.net/forum/post/73707</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73707</guid><dc:creator><![CDATA[merkvilson]]></dc:creator><pubDate>Tue, 06 Feb 2024 11:28:39 GMT</pubDate></item><item><title><![CDATA[Reply to GUI Bitmap Button Properties on Tue, 06 Feb 2024 10:45:08 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/merkvilson">@<bdi>merkvilson</bdi></a>,</p>
<p dir="auto">Thank you for reaching out to us. Your thread is still okay, but you are surfing here on the edge of <em>'too many questions in one topic'</em>. Please note that our <a href="https://developers.maxon.net/forum/topic/15244" target="_blank" rel="noopener noreferrer nofollow ugc">Support Procedures</a> require users to ask question(s) on a singular well-defined subject in a thread. This cannot become a <em>'everything about GeDialog'</em> or <em>'everything about bitmap buttons'</em> thread.</p>
<h3>About your Questions</h3>
<blockquote>
<p dir="auto">How to remove padding between buttons?</p>
</blockquote>
<p dir="auto">The padding between elements of a group in a dialog is controlled with <code>GeDialog.GroupSpace</code>.</p>
<blockquote>
<p dir="auto">How to change BITMAPBUTTON_BACKCOLOR via the Command?</p>
</blockquote>
<p dir="auto">I am not sure if I am understanding your question here correctly. You want to change the background color of a button after <code>CreateLayout</code> ran? That is not possible. You can flush layout groups and rebuild them at runtime (with buttons with a new color for example). I showed <a href="https://developers.maxon.net/forum/topic/14256/python-plugin-gui-tutorial/4" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> once the pattern of a dynamic dialog.</p>
<blockquote>
<p dir="auto">How to activate fading fading when the back color is activated?</p>
</blockquote>
<p dir="auto">I do not think that is possible, because for that you would have to define a second color to fade to. And I do not see any option to do this in the <a href="https://developers.maxon.net/docs/py/2024_2_0/modules/c4d.gui/BaseCustomGui/BitmapButtonCustomGui/index.html" target="_blank" rel="noopener noreferrer nofollow ugc">settings of this custom GUI</a>.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
<p dir="auto">Result:<br />
<img src="/forum/assets/uploads/files/1707216305395-aa7ce012-73b7-4c0f-ae3f-4547a0144f0d-image.png" alt="aa7ce012-73b7-4c0f-ae3f-4547a0144f0d-image.png" class=" img-fluid img-markdown" /><br />
Code:</p>
<pre><code class="language-py">import c4d

class test_dialog(c4d.gui.GeDialog):

    def CreateLayout(self):
        """
        """
        # In a GeDialog, two methods control the spacing of elements, GroupSpace() and 
        # GroupBorderSpace(). Both methods apply to the group context they are called in. When
        # we do not add a group, they will apply to they outmost and dialog group added by the 
        # dialog itself.

        self.GroupBegin(id=0, flags=c4d.BFH_SCALEFIT, rows=1, title=" ", cols=2, groupflags=0)

        self.GroupSpace(0, 0) # The horizontal and vertical spacing between two elements for id=0.
        self.GroupBorderSpace(10, 10, 10, 10) # The space at borders of the group for id=0.

        bc = c4d.BaseContainer()
        bc[c4d.BITMAPBUTTON_BUTTON] = True
        bc[c4d.BITMAPBUTTON_ICONID1] = c4d.Ocube
        bc[c4d.BITMAPBUTTON_BACKCOLOR] = c4d.COLOR_BG_PALETTE
        bc[c4d.BITMAPBUTTON_DISABLE_FADING] = False
        self.bitmapButton = self.AddCustomGui(100001,
                                              c4d.CUSTOMGUI_BITMAPBUTTON, "",
                                              c4d.BFH_CENTER | c4d.BFV_CENTER,
                                              0, 0, bc)

        bc = c4d.BaseContainer()
        bc[c4d.BITMAPBUTTON_BUTTON] = True
        bc[c4d.BITMAPBUTTON_ICONID1] = c4d.Osphere
        bc[c4d.BITMAPBUTTON_BACKCOLOR] = c4d.COLOR_BG_PALETTE
        bc[c4d.BITMAPBUTTON_DISABLE_FADING] = False
        self.bitmapButton = self.AddCustomGui(100002,
                                              c4d.CUSTOMGUI_BITMAPBUTTON, "",
                                              c4d.BFH_CENTER | c4d.BFV_CENTER,
                                              0, 0, bc)
        
        # You were also missing this call, it is important to close groups.
        self.GroupEnd() 
        return True


def main():
    # Doing this is dangerous, you create a dangling dialog instance with this. Never use store
    # dialog in a script module or use the global pattern (which just creates an attribute in the
    # module). It is fine to do this for development and testing, but production ASYNC dialogs are
    # not supported by Script Manager scripts.
    global dialog
    dialog = test_dialog()
    dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, defaultw=-2, defaulth=-2)


if __name__ == '__main__':
    main()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/73705</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73705</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Tue, 06 Feb 2024 10:45:08 GMT</pubDate></item><item><title><![CDATA[Reply to GUI Bitmap Button Properties on Tue, 06 Feb 2024 00:43:43 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/wickedp">@<bdi>WickedP</bdi></a><br />
Thanks for your answer but unfortunately, that's not the case.</p>
]]></description><link>http://developers.maxon.net/forum/post/73694</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73694</guid><dc:creator><![CDATA[merkvilson]]></dc:creator><pubDate>Tue, 06 Feb 2024 00:43:43 GMT</pubDate></item><item><title><![CDATA[Reply to GUI Bitmap Button Properties on Tue, 06 Feb 2024 00:39:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/merkvilson">@<bdi>merkvilson</bdi></a></p>
<p dir="auto">This may not help, I'm not a python coder, but for the padding, it might be worth trying to set the BITMAPBUTTON_NOBORDERDRAW flag. I can't tell from the screen shot if that's happening here, but it might be the button border? See if that helps.</p>
<p dir="auto">I'll let others help you with your other queries.</p>
<p dir="auto">WP.</p>
]]></description><link>http://developers.maxon.net/forum/post/73693</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73693</guid><dc:creator><![CDATA[WickedP]]></dc:creator><pubDate>Tue, 06 Feb 2024 00:39:31 GMT</pubDate></item></channel></rss>