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'm hoping to add some Bitmap Buttons to a project I'm working on, but I'm having difficulty styling them (and initially: creating them).
def AddIconButton(self, button_id, title, icon_id, tooltip, border=c4d.BORDER_ROUND):
"""
Reference:
"""
bc = c4d.BaseContainer()
bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True)
bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, icon_id)
bc.SetInt32(c4d.BITMAPBUTTON_OUTBORDER, border)
bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, tooltip)
bc.SetString(c4d.BITMAPBUTTON_STRING, title)
icon_width_height = 24
bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, icon_width_height)
button = self.AddCustomGui(button_id, c4d.CUSTOMGUI_BITMAPBUTTON, title, c4d.BFH_LEFT, 0, 0, bc)
return button
A lot of the styling flags seem to have no impact. Specifically:
BITMAPBUTTON_BORDER
BITMAPBUTTON_STRING
I created some simple test code to show each of the styles and the buttons looked identical:
bitmapbutton_border_styles = [("BORDER_NONE", c4d.BORDER_NONE),
("BORDER_THIN_IN", c4d.BORDER_THIN_IN),
("BORDER_THIN_OUT", c4d.BORDER_THIN_OUT),
("BORDER_IN", c4d.BORDER_IN),
("BORDER_OUT", c4d.BORDER_OUT),
("BORDER_GROUP_IN", c4d.BORDER_GROUP_IN),
("BORDER_GROUP_OUT", c4d.BORDER_GROUP_OUT),
("BORDER_OUT2", c4d.BORDER_OUT2),
("BORDER_OUT3", c4d.BORDER_OUT3),
("BORDER_BLACK", c4d.BORDER_BLACK),
("BORDER_ACTIVE_1", c4d.BORDER_ACTIVE_1),
("BORDER_ACTIVE_2", c4d.BORDER_ACTIVE_2),
("BORDER_ACTIVE_3", c4d.BORDER_ACTIVE_3),
("BORDER_ACTIVE_4", c4d.BORDER_ACTIVE_4),
("BORDER_GROUP_TOP", c4d.BORDER_GROUP_TOP),
("BORDER_ROUND", c4d.BORDER_ROUND),
("BORDER_SCHEME_EDIT", c4d.BORDER_SCHEME_EDIT),
("BORDER_SCHEME_EDIT_NUMERIC", c4d.BORDER_SCHEME_EDIT_NUMERIC),
("BORDER_OUT3l", c4d.BORDER_OUT3l),
("BORDER_OUT3r", c4d.BORDER_OUT3r),
("BORDER_THIN_INb", c4d.BORDER_THIN_INb),
("BORDER_MASK", c4d.BORDER_MASK),
("BORDER_TEXT_DOTTED", c4d.BORDER_TEXT_DOTTED),
("BORDER_WITH_TITLE_MONO", c4d.BORDER_WITH_TITLE_MONO),
("BORDER_WITH_TITLE_BOLD", c4d.BORDER_WITH_TITLE_BOLD),
("BORDER_WITH_TITLE", c4d.BORDER_WITH_TITLE)]
for border_id_name, border_id in bitmapbutton_border_styles:
self.AddIconButton(0, border_id_name, ICON_NEW_PROJECT, border_id_name, border=border_id)
Ideally, I'd love a button that matches the look/feel of docked icons w/ text:
Any suggestions?
Also, FWIW, some sample code for how to add BitmapButtons inside of the BitmapButton class would be really helpful. I struggled for quite a while trying to create a button using c4d.gui.BitmapButtonCustomGui() but was stumped when I couldn't figure out how to add it to a dialog.
Thank you,
c4d.gui.BitmapButtonCustomGui()
Donovan
Any suggestions?
While I cannot say much about your problem, here are some bits that you might (or might not) find useful.
SPLINE
CustomGui
Cheers
zipit
@zipit said in Styling BitmapButtons:
While I cannot say much about your problem, here are some bits that you might (or might not) find useful.
Thank you for taking the time to respond!
Have you tried / is it possible for your task to define your dialog resource as a file system rather than by code?
My interface includes a large list of dynamic elements. I'm not sure that I'll be able to give each a unique ID unless I create them with code. But I'll see if I can restructure at least some of this.
Although I cannot find the exact passage right now, it says somewhere in the docs, that you should use files, since it is the only way to get all features, except for menus, which are only constructable by code.
Although I cannot find the exact passage right now, it says somewhere in the docs, that you should use files, since it is the only way to get all features, except for menus, which are only constructable by code.
Gotcha. Good to know. The docs have really improved, but there's lots of little tidbits like this that you'll only see if you read every page of every parent class rather than seeing all of the relevant info in the method definition.
I came to the (unconfirmed) conclusion, that some of the more exotic CustomGui data types are apparently not fully supported for dialog resources (the same definition for a SPLINE gadget worked just fine in a description resource) and wrote my own little thing.
Ah. That makes sense as well. I think for now I'll live with the stylistic limitations of the current BitmapButton as it's easier than writing my own.
Thanks!
Hi sorry to not replied earlier.
BITMAPBUTTON_STRING works fine, but if BITMAPBUTTON_FORCE_SIZE is defined to a very small size, then the string will be hidden (since you force to clip the size of the button).
BITMAPBUTTON_OUTBORDER didn't work at all and BITMAPBUTTON_BORDER partially works (only one border supported).
So I've reported the issue. I will bump the topic when the issue will be fixed.
Thanks a lot for reporting.
Cheers,
Maxime.
Hi, this is fixed in R21.1 SP1.