Creating a Custom Button

You can create your own colorized button object rather than use the standard command button included in the Controls Catalog.

  To create a custom command button:

  1. From the Elements pane, expand the folder containing the desired graphic object such as a rectangle or round rectangle object.

  2. Select the graphic object; then, drag and drop the object into the Contents frame.

  3. Double-click the graphic object to display the Properties dialog box.

    The Object tab is displayed.

  4. Type a new entry in the Name field and in the Title field.

    The entry in the Title field is displayed as a label on the control object. The entry in the Name field is displayed on the Title bar in the Script Editor and in the object model.

  5. Click the Border and Background tab.

  6. Select the color you want to assign to the border of the button from the Color palette in the Border section.

  7. Select the color you want to assign to the background of the bottom from the Background section.

  8. Click OK.

  9. Select Scripts from the shortcut menu.

    The objects name (as show in the Name field of the Properties dialog box) is displayed on the Title bar of the Script Editor, and the default event for the object (OnClick) is displayed in the Event drop-down list box.

  10. Add any scripts you want to associate with the custom button object.

    For example, if you wanted to change the fill color of a radio button, you could type the following in the Script Editor:

    //Button color, hex
    ActiveSection.Shapes["RadioButton1"].Fill.Color = 0xFF3399
  11. Click OK.

  12. Type a new entry in the Name field and in the Title field.

  13. Drag a text label object from the Graphics folder and place it on your custom button object.

  14. Click the Border and Background tab.

  15. Select the color you want to assign to the border of the text label from the Color palette in the Border section.

  16. Select the color you want to assign to the background of the text label from the Background section.

  17. Set font and size of the text if desired.

  18. Click OK.

  19. Select Scripts from the shortcut menu.

  20. Copy and paste the script from the button object to the OnClick script for the text label.

    If the name of the button object is displayed in the script associated with the text label, rename the button object to the name of the text label object. This will ensure that both the text label and button object remain dynamic.