# coyote: FSC_COLORSELECT

- coyote/General Programming
- [Source code]

NAME

      FSC_COLORSELECT

PURPOSE

      The purpose of this compound widget is to provide a means for selecting
      a new color or color table in a widget program. The program consists of
      a label, a non-editable text widget, and a button to make a color or
      color table selection interactively. (See the example program.)

AUTHOR

      FANNING SOFTWARE CONSULTING
      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com/

CATEGORY

      General programming.

CALLING SEQUENCE

      objectRef = FSC_COLORSELECT(parent, Title='Annotate Color ", Color='red')

INPUT PARAMETERS

      parent -- The parent widget ID of the compound widget. Required.

INPUT KEYWORDS

      BREWER:        Set if you want Brewer color tables, rather than the normal IDL color tables.
                     This requires the file fsc_brewer.tbl to be in your IDL path.
      CFONT:         Set to the name of a font to display the color name in.
      COLOR:         The name of the color to be displayed in the widget. If color
                     is not used, or if it is set to a null string, then the widget
                     will allow selection of a color table, instead of a color name.
      CT_INDEX:      The color table index number you wish to use. The actual name of the
                     color table will be displayed in the widget.
      EVENT_FUNC:   Set this keyword to the name of an Event Function. If this
                    keyword is undefined and the Event_Pro keyword is undefined,
                    all compound widget events are handled internally and not
                    passed on to the parent widget.
      EVENT_PRO:    Set this keyword to the name of an Event Procedure. If this
                    keyword is undefined and the Event_Func keyword is undefined,
                    all compound widget events are handled internally and not
                    passed on to the parent widget.
      FRAME:        Set this keyword to put a frame around the compound widget.
      LABELALIGN:  Set this keyword to align label text. [0-center (default), 1-left, 2-right].
      LABELFONT:   The font name for the text in the Label Widget.
      LABELSIZE:   The X screen size of the Label Widget.
      NAME:        A scalar string name of the object. (Default = ''.)
      SCR_XSIZE:   The X screen size of the compound widget.
      SCR_YSIZE:   The Y screen size of the compound widget.
      STYLE:       The "style" of the text in the Text Widget. A value of 0 (the default)
                   capitalizes the first letter in the name. A style of 1 uses all lowercase.
                   A style of 2 uses all uppercase.
      TITLE:       The text to go on the Label Widget.
      UVALUE:      A user value for any purpose.
      XSIZE:       The X size of the Text Widget.
      In addition, any keyword defined for WIDGET_TEXT, but not defined here (e.g., SENSITIVE), is
      passed along without inspection to the text widget. Use of "extra" keywords is discouraged.

COMMON BLOCKS

      None.

RESTRICTIONS

      None.

EVENT STRUCTURE

      All events are handled internally unless either the Event_Pro or Event_Func
      keywords are used to assign an event handler to the compound widget.
      event = { FSC_ColorSelect_Event, $; The name of the event structure.
                ID: 0L, $              ; The ID of the compound widget's top-level base.
                TOP: 0L, $             ; The widget ID of the top-level base of the hierarchy.
                HANDLER: 0L, $         ; The event handler ID. Filled out by IDL.
                Color: "", $           ; The name of the current color or color table.
                Index: 0L, $           ; The color table index selected if color tables are used.
                Brewer: 0L, $          ; A flag that indicated Brewer color tables are being used.
                NColors: 0L, $         ; The number of colors used for the color table.
                ObjRef:Obj_New()}      ; The "self" object.

GETTING and SETTING VALUES

      Almost all the properties of the widget can be obtained or set via
      the object's GetProperty and SetProperty methods (described below).
      But since traditional compound widgets have the ability to get and
      set the value of the compound widget, this capability is implemented
      as special methods: Get_Color/Set_Color and Get_Color_Index/Set_Color_Index.
      To get the color of the widget, do this: color = objectRef->Get_Color()
      To set the color of the widget, do this: objectRef->Set_Color, 'blue'.
      Valid colors are those returned by FSC_Color. Getting and setting the
      color table index number works similarly.

EXAMPLE

      An example program is provided at the end of the FSC_COLORSELECT code. To run it,
      type these commands:
         IDL> .Compile FSC_COLORSELECT
         IDL> Example

DEPENDENCIES

      Requires the Coyote Library:
        http://www.idlcoyote.com/programs/coyoteprograms.zip

MODIFICATION HISTORY

      Written by: David W. Fanning, 26 JULY 2010.