Advanced - Custom Parameters and Colors

You may want to add parameters to your paintbar that can be set by the paintbar's user. This can be done in the following manner:

 

Define the Parameter in Code

 

Do that by calling the following procedure anywhere in the paintbar code. NOTE: all parameters must be literals, not variables, otherwise the parsing of paintbars will not pick this up.

 

        public void DefinePaintbarParameter(String ParameterID, string ParameterDescription, Boolean IsInteger, Double Minimum, Double Maximum, Double Increment = 1, Double Default = 0)

 

 

ParameterID

a String identifier for the parameter that you can use in further code to get its value that was set by the user

ParameterDescription

a String description for the parameter that will be shown to the user in the paintbar parameter editor

IsInteger

pass true if the parameter should be an integer, false otherwise

Minimum

Double - the minimum value for the parameter

Maximum

Double - the maximum value for the parameter

Increment

Double - the increment for the up/down arrows on the parameter selector

Default

Double - the default value for the parameter

 

Use the Parameter

 

To get the parameter's value in code, call this function, passing it the ParameterID. It will return the Double value of the parameter.

 

 public Double GetPaintbarParameter(String ParameterID)

 

Define Colors in Code

 

You can give names to colors either in the simple editor or in advanced editor's code by either

 

Specifying the color name in the SetColor or SetColorAndShape function call

 

Calling the GetNamedColor function.

 

Every named color will then show up in the paintbar parameters dialog that will allow the user to change the color.