Color Pickers in Dialog Boxes

 

To set the color of a series, use a drop-down list box of specific color choices or place a color picker control in the dialog box menu.  The color picker will display a colored rectangle in the input field beside the name of the color.  To include a color picker control, put a p modifier into the braces in the menu file’s display area.  For example:   

 

// colorex1.pan - color example

@dialog

 

Series Color

 

Generate Function: <w=30>~< >(100,.01)~<Grandom><Gnormal>

Series Color:      <p w=30>~scolor = < >~<LRED><LGREEN><LBLUE>

<L>

~menuclear

~sercolor(scolor)

 

 

 

The integer value of the selected color is assigned to the variable scolor and the SERCOLOR function sets the generated series color.

 

DADiSP provides the _choosecolor() function to simplify the selection of colors. For example:

 

// colorex2.pan - color example

@dialog

 

// get series current color

{setvar("scolor", getwcolor(1, 1))}

 

Series Color

Current Series Color: <= p n w=30>~scolor = <{scolor}>~_choosecolor

<L>

~menuclear

~sercolor(scolor)

 

 

 

In this example, the panel calls GETWCOLOR to display the color of the series in the current window. The series is set to the new color if the OK button is pressed. The _choosecolor() function provides a list of all the currently available colors and because the n modifier is specified, the color is returned as an integer value appropriate for the SERCOLOR function.