Adding flexibility using parameters

By default, an object uses static values to control its size. For example, the progressbar object created in Working with symbols has a minimum width of 0 and a maximum width of 120. The transformation added in Transforming an object still leaves the maximum at 100. To create reusable symbols, use parameters to control size. This way, the size of a symbol can be easily adjusted for inclusion in a symbol with different dimensions.
To add flexibility to the basicprogressbar symbol:
  1. Open the basicprogressbar symbol.
  2. Create a new Integer parameter, maxwidth, with a default value of 100.
    For more information, see Creating a new parameter.
  3. Create a new Integer parameter, minwidth, with a default value of 0.
    For more information, see Creating a new parameter.
  4. Select the progressbar element in the Symbol Outline pane.
  5. Click the Transform tab in the Styling Customizer.
    In the previous step, you bound the width of the progressbar object to the progress parameter. Now you want to bind this width to the new parameters, minwidth and maxwidth. To do so, you have to unset the previous binding.
  6. Click the small triangle next to the Width field in the Transform tab.
    The Bind button is available again.
  7. Click the Bind button next to the Width field.
    The Transform Element Using Parameter dialog box opens.
  8. From the Parameter list, select progress
  9. Select the Compute the transformation according to the following min/max values check box.
  10. From the Parameter Max list, select maxwidth.
  11. In the Value Max field, type 120
  12. From the Parameter Min list, select minwidth.
    diasym_bindtransformation31.png
    Binding a transformation to parameters
  13. Click OK.
Note
The width of a transformed object is calculated in function of the Parameter Max, Parameter Min, Value Max, and Value Min parameter values set in the Transform Element Using Parameter dialog box. If you take the value of Parameter Max to represent 100% of Value Max, the basicprogressbar symbol will expand to the width Value Max in function of the value of Parameter Max. That is, when the progress parameter has a value of 100, the basicprogressbar will be 120 pixels wide.
You can now set the maximum width for this object by changing either the default or the dynamic value of the maxwidth parameter.