# coyote: COLORBUTTONBITMAP

- coyote/Widget Programming
- [Source code]

NAME

      ColorButtonBitmap

PURPOSE

      The purpose of this program is to create a 24-bit bitmap that can be used to
      create a colored widget button.

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

      Widget Programming

CALLING SEQUENCE

      bitmap = ColorButtonBitmap(theText)
      button = Widget_Button(tlb, Value=bitmap)

REQUIRED INPUTS

      theText - The text you wish to have on the button.

OUTPUTS

      bitmap - A 3xMxN byte array, representing a 24-bit image that is used
               as a button value.

OPTIONAL KEYWORDS

      BGCOLOR - The name of the background color. For example, 'Yellow', 'Tan', etc.
                The name must be compatible with names appropriate for cgColor.
      FGCOLOR - The name of the foreground color. For example, 'Navy', 'Black', etc.
                The name must be compatible with names appropriate for cgColor.

DEPENDENCIES

      Reqires cgColor from the Coyote Library:
                    http://www.idlcoyote.com/programs/cgColor.pro

EXAMPLE

      tlb = Widget_Base(/Row, /Exclusive)
      button1 = Widget_Button(tlb, Value=ColorButtonBitmap('Button 1')) ; Normal button.
      button2 = Widget_Button(tlb, Value=ColorButtonBitmap('Button 2', FGCOLOR='YELLOW', BGCOLOR='NAVY'))
      button3 = Widget_Button(tlb, Value=ColorButtonBitmap('Button 3', BGCOLOR='YELLOW', FGCOLOR='NAVY'))
      Widget_Control, tlb, /Realize

MODIFICATION HISTORY

      Written by David Fanning, May 25, 2007 based on code named BitmapForButtonText supplied to the IDL
      newsgroup by Dick Jackson: http://www.idlcoyote.com/tip_examples/bitmapforbuttontext.pro.
      Fixed a problem with foreground and background colors that caused them to work correctly only
          when color decomposition is on--as it should be :-). 6 May 2009.