Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++

Custom buttons and the integrated Style Designer

Author: Jorge Batista

With the integrated Style Designer in RAD Studio Berlin, you can quickly create custom image buttons. For creating entire multi-device styles from scratch, we recommend you use the Bitmap Style Designer, available via the Tools menu.

  1. Create a new FireMonkey multi-device application.
  2. Select a “Style” from the drop-down menu in the FireUI Designer. This will allow you to create a custom style for that platform. You can also change the platform in the Style Designer later.
  3. Drop a TButton onto your form.
  4. Right-click on the button and select “Edit Default Style“.
  5. Drag and drop TImage from the Object Inspector onto the buttonstyle layout in the Structure pane.
  6. Select Image1Style in the Structure pane.
  7. In the ObjectInspector, select MultiResBitmap and load your image file (e.g. battery.png) and set Margins.
  8. Select “buttonstyle” in the Structure Pane, then change the name in the Object Inspector to make the style easily identifiable in the list of style elements (e.g. buttonstyle_battery).
  9. Apply the changes and close the Style Designer by clicking on the “x” in the top right hand corner.
  10. Ensure that the StyleBook property for your form is set to StyleBook1.
  11. Select the button control on your form, and set StyleLookUp to buttonstyle_battery.
  12. Repeat the steps to create a custom button style for each platform.

 

 

When right-clicking on a FireMonkey control, you see two different style related options:

Edit Default Style:

  • Opens a new FireMonkey Style Designer window in which you can modify the style for the component class. For example, if you right-clicked a button, you can modify the “buttonStyle” object (a default style for the TButton class).

Edit Custom Style:

  • Opens a new FireMonkey Style Designer window in which you can modify the selected control style. For example, if you right-clicked a button, you can modify the “button1Style” object (a style for this button only).

 

Special Offers

Get More. Do More. Spend Less

Six Great Offers for the Holiday Season. Get RAD Studio Berlin today!

 

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES