BitmapButtonCustomGui hover



  • Hi folks,

    is there a flag to prevent the change in background colour when you hover over a BitmapButtonCustomGui with a transparent image on it? I want just a static image that does nothing when you mouse over. I'm currently using a GeUserArea, which works fine, but seems a little cumbersome to make just for a static image.

    Or is the user area the only way?

    WP.



  • Hi @WickedP,

    thank you for reaching out to us. And the answer to your question is: Yes, this is possible with a BitmapButtonCustomGui. However, this feature is only available with S22 onwards (please remember to add version tags to your posting in the future). The relevant flags are documented here for C++ and here for Python (I am aware that you are on C++, but the Python docs are a bit nicer in this case). The settings flag you can use for this with S22+ is BITMAPBUTTON_DISABLE_FADING. I have added the little Python script with which I did test the flag at the end. When you need a specific C++ version or any further help, please do not hesitate to ask.

    Cheers,
    Ferdinand

    import c4d
    
    class PC13071Dialog(c4d.gui.GeDialog):
        """Dialog demonstrating a CUSTOMGUI_BITMAPBUTTON with a static background
        color.
        """
        ID_BITMAP_BUTTON = 10000 # The gadget ID for the button.
    
        def CreateLayout(self):
            """Creates the layout for the dialog.
            """
            # The settings for the CUSTOMGUI_BITMAPBUTTON
            bc = c4d.BaseContainer()
            # Its a bitmap button.
            bc[c4d.BITMAPBUTTON_BUTTON] = True
            # The first icon (and only icon for a non-toggle button).
            bc[c4d.BITMAPBUTTON_ICONID1] = c4d.OBJECT_FIGURE
            # The default background color.
            bc[c4d.BITMAPBUTTON_BACKCOLOR] = c4d.COLOR_BG
            # Disable the mouse over fading. This feature is only available in
            # S22 onwards (which the C++ docs do not currently point out 
            # correctly).
            bc[c4d.BITMAPBUTTON_DISABLE_FADING] = False
            # Add the gadget.
            self.bitmapButton = self.AddCustomGui(PC13071Dialog.ID_BITMAP_BUTTON,
                                                  c4d.CUSTOMGUI_BITMAPBUTTON, "",
                                                  c4d.BFH_CENTER | c4d.BFV_CENTER,
                                                  0, 0, bc)
    
            return True
    
    def main():
        """Entry point.
        """
        # Little nasty hack to expose the dialog object to the module and make 
        # async dialogs work (which is required for the bitmap button). Please 
        # do not do this an production environment. This is only for the purpose
        # of quickly demonstrating the CUSTOMGUI_BITMAPBUTTON.
        global dialog
        # Open our dialog.
        dialog = PC13071Dialog()
        dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, defaultw=-2, defaulth=-2)
    
    
    if __name__ == '__main__':
        main()
    


  • Thanks Ferdinand,

    sounds like it won't be available for me (I'm pre-s22). I can live with the GeUserArea, but good to know it's available for more recent releases.

    Two other things. Firstly, congrats on becoming a Maxon support member!

    Secondly, I can't seem to mark any topics of mine as solved. Has this changed?

    WP.



  • Hi @WickedP,

    Secondly, I can't seem to mark any topics of mine as solved. Has this changed?

    that is because you haven't set your topic as "ask-as-question" in the first place ;) So there is nothing to resolve here.

    Cheers,
    Ferdinand


Log in to reply