home *** CD-ROM | disk | FTP | other *** search
/ Windows Shareware GOLD / NuclearComputingVol3No1.cdr / _bbs3 / f1530.zip / README.TXT < prev    next >
Text File  |  1991-08-25  |  39KB  |  778 lines

  1.                                     CLRCTRL
  2.                       Color Selector Custom Dialog Control
  3.                     for Microsoft Windows (tm) Applications
  4.  
  5.                                   Version 1.2
  6.                                    8/25/1991
  7.  
  8.                                Copyright (c) 1991
  9.                                 Clickon Software
  10.  
  11.                                  Scott Gourley
  12.                             Compuserve ID 72311,613
  13.                      105 Union Street, Watertown, MA 02172
  14.                                  (617)-924-5761
  15.  
  16.       Thank you for trying this product!
  17.  
  18.       CLRCTRL is a kit that makes it easy for Microsoft Windows 3.0
  19.       programmers to include color selection controls in their
  20.       application dialogs.  The core of the kit is a "dynamic link
  21.       library," CLRCTRL.DLL, which provides the dialog control in a
  22.       self-contained package that can easily be integrated into any
  23.       program.  The design of the DLL allows the custom control to be
  24.       manipulated the same way a built-in control is manipulated, using
  25.       the Dialog Editor found in the Microsoft Software Development Kit.
  26.  
  27.       The design of the control is that of a combobox that contains
  28.       rectangles of color that can be selected by the user using the
  29.       normal input actions for comboboxes.  The advantage of this method
  30.       of color selection is that it allows an easy, familiar way for the
  31.       user to make a color selection, while requiring minimal space for
  32.       the control on the dialog box.
  33.  
  34.       By default, the color selector uses the standard 16 "pure" colors
  35.       as its selection palette, but this can be changed using normal
  36.       combobox messages.  The following table gives the "pure" colors
  37.       and their positions in the default color selector control.
  38.  
  39.                                                            Index in
  40.       Color                  RGB value                   combobox list
  41.       ----------------------------------------------------------------
  42.       Black                  RGB (0x00, 0x00, 0x00)           0
  43.       Dark Red               RGB (0x80, 0x00, 0x00)           1
  44.       Dark Green             RGB (0x00, 0x80, 0x00)           2
  45.       Dark Yellow            RGB (0x80, 0x80, 0x00)           3
  46.       Dark Blue              RGB (0x00, 0x00, 0x80)           4
  47.       Dark Magenta           RGB (0x80, 0x00, 0x80)           5
  48.       Dark Cyan              RGB (0x00, 0x80, 0x80)           6
  49.       Dark Grey              RGB (0x80, 0x80, 0x80)           7
  50.       Bright Grey            RGB (0xC0, 0xC0, 0xC0)           8
  51.       Bright Red             RGB (0xFF, 0x00, 0x00)           9
  52.       Bright Green           RGB (0x00, 0xFF, 0x00)          10
  53.       Bright Yellow          RGB (0xFF, 0xFF, 0x00)          11
  54.       Bright Blue            RGB (0x00, 0x00, 0xFF)          12
  55.       Bright Magenta         RGB (0xFF, 0x00, 0xFF)          13
  56.       Bright Cyan            RGB (0x00, 0xFF, 0xFF)          14
  57.       White                  RGB (0xFF, 0xFF, 0xFF)          15
  58.  
  59.  
  60.       FILES INCLUDED IN THIS KIT
  61.  
  62.       The following files are included in this kit:
  63.  
  64.       Custom control files
  65.       --------------------
  66.  
  67.       CLRCTRL.DLL   This is the dynamic link library containing the code
  68.                     that defines and maintains the color selector
  69.                     control.  The library includes code to interface with
  70.                     the user program as well as code to interface with
  71.                     the SDK Dialog Editor.
  72.       CLRCTRL.H     This is the header file that defines the source-code
  73.                     interface to the control.  It contains information
  74.                     that the user program can use to access the control
  75.                     and its DLL library.
  76.  
  77.       Sample program files
  78.       --------------------
  79.  
  80.       CLRTEST       This is the makefile for the CLRTEST.EXE program.
  81.                     It should be generic enough to build the program in
  82.                     your environment.  If not, it can be easily
  83.                     modified.
  84.       CLRTEST.C     This is the source code for the CLRTEST.EXE program.
  85.                     This program provides a simple test of the
  86.                     functioning of the color selector, and serves as an
  87.                     example of using the custom control kit.
  88.       CLRTEST.H     This is the main header file for the CLRTEST.EXE
  89.                     test program.  It contains menu IDs, prototypes,
  90.                     variable defaults, and other information needed by
  91.                     the program.
  92.       CLRTESTD.H    This is the header that contains the dialog IDs used
  93.                     for controls defined in the dialog in CLRTEST.DLG.  
  94.       WINSTD.H      This is a general header file of information to
  95.                     configure Windows applications.
  96.       CLRTEST.DEF   This is the module definition file for the
  97.                     CLRTEST.EXE program.  All Windows applications
  98.                     require a module definition file.
  99.       CLRTEST.RC    This is the resource script file for the CLRTEST.EXE
  100.                     test program.  It contains a definition of the
  101.                     application menu structure.
  102.       CLRTEST.DLG   This is the dialog definition for CLRTEST.EXE test
  103.                     program.  The dialog allows the user to select a
  104.                     text color and a background color, and uses this
  105.                     data to paint the program's main window.
  106.       CLRTEST.ICO   This is the program icon for the CLRTEST.EXE test
  107.                     program.
  108.       CLRTEST.EXE   This is a pre-built copy of the color selector test
  109.                     program.
  110.  
  111.       Documentation files
  112.       -------------------
  113.  
  114.       CLRCTRL.HLP   This is the Windows help file that explains this
  115.                     software kit and how to use it.  It contains largely
  116.                     the same information as this text.
  117.       README.TXT    This text.
  118.  
  119.  
  120.       OBJ Interface files (registered kit only)
  121.       -----------------------------------------
  122.  
  123.       CLRCTRLS.OBJ  Small model object code for control's OBJ interface
  124.       CLRCTRLM.OBJ  Medium model object code for control's OBJ interface
  125.       CLRCTRLL.OBJ  Large model object code for control's OBJ interface
  126.  
  127.  
  128.       USES FOR THIS PRODUCT
  129.  
  130.       This custom dialog control gives the Windows programmer a tool to
  131.       easily include color selection in Windows dialogs.  Also, because
  132.       the control is flexible enough to allow its behavior to be
  133.       modified by the programmer, it is useful in any situation where a
  134.       selection of color must be provided.  These situations range from
  135.       simple text and background color selection in a text-based
  136.       application to palette definition in a paint program.  It can be
  137.       up to the programmer what color choices are available and what the
  138.       color choice means to the application program.
  139.  
  140.  
  141.       COLOR SELECTOR CONTROL BEHAVIOR
  142.  
  143.       Because the color selector control is defined as a combobox, all
  144.       of the behavior associated with a normal combobox is supported in
  145.       the color selector.  The only exception to this is that direct
  146.       text entry in the edit field is not implemented.  Because of this,
  147.       the style of the control is more appropriately described as a
  148.       "drop-down listbox," rather than a "combobox," which is used in
  149.       this discussion for consistency with Microsoft's use of the
  150.       terminology. The following paragraphs briefly describe the normal
  151.       functioning of a color selector control.
  152.  
  153.       Keyboard interface
  154.  
  155.       The color selector control receives and relinquishes the keyboard
  156.       input focus as any other control does.  If the programmer defines
  157.       the control to have the WS_TAB style, the user can give the control
  158.       input focus by moving to the control with the TAB key.  If the
  159.       programmer defines the control to be in a group using WS_GROUP, the
  160.       left and right arrow keys also can be used to give the control the
  161.       input focus.  Moving the input focus out of the color selector
  162.       works in the same way.
  163.  
  164.       Once the control has the input focus, the up and down arrows cause
  165.       the currently selected color as displayed in the edit box, to
  166.       change, moving through the defined set of color choices.  Pressing
  167.       Alt-Up arrow or Alt-Down arrow will both cause the listbox to be
  168.       alternately dropped down and removed.  While dropped down, the
  169.       list box will display up to six of the colors defined in the list.
  170.       The up and down arrows then still work in the normal way, moving
  171.       the "item selected" highlighting through the list box as
  172.       appropriate.
  173.  
  174.       Mouse interface
  175.       
  176.       With a mouse, the interface is also straightforward.  Clicking the
  177.       mouse on the control will give the control the input focus if it
  178.       does not already have it.  When it has the input focus, clicking
  179.       on another control will cause the control to lose the input focus.
  180.  
  181.       Clicking on the drop-down button of the control will cause the
  182.       listbox to be displayed (or removed if it is already displayed) as
  183.       described above.  When the list box is dropped down, a new color
  184.       can be selected by using the mouse to scroll through the list and
  185.       click on another color.
  186.  
  187.  
  188.       IMPLEMENTING COLOR SELECTORS
  189.  
  190.       The following sections describe what needs to be done to add color
  191.       selector controls to an application.  The process divides into
  192.       three main parts: accessing the control's DLL; creating and
  193.       editing the dialog with the Dialog Editor; and accessing the
  194.       control from the dialog procedure using the Windows messaging
  195.       scheme.
  196.  
  197.       Accessing the DLL
  198.       -----------------
  199.  
  200.       To use the color selector control, the application must access the
  201.       dynamic link library (DLL) file for the control.  To accomplish
  202.       this, the following steps are necessary:
  203.  
  204.       1.    Load the library.
  205.         
  206.             During program initialization, the DLL library must be
  207.             loaded and initialized by the program.  Add the following
  208.             code to the WinMain function somewhere before the main
  209.             message loop:
  210.  
  211.             HANDLE hClrLib;
  212.             .
  213.             .
  214.             .
  215.             if ((hClrLib = LoadLibrary ("clrctrl.dll")) < 32) return 0;
  216.  
  217.             This code loads the library for the color selector control.
  218.             If it cannot be loaded, returning a zero value from WinMain
  219.             will cause the program to end.  (If program clean-up is
  220.             necessary, do it before the return statement.)
  221.  
  222.             Note that the name of the DLL file is defined in the
  223.             clrctrl.h header file under the symbol "CLRCTRL_DLLNAME."
  224.             This symbol can be used in the LoadLibrary call, provided
  225.             the clrctrl.h file is included by the .c file that contains
  226.             WinMain.
  227.  
  228.       2.    Free the library.
  229.  
  230.             During program shutdown, the DLL library must be released by
  231.             the application.  Add the following code to the WinMain
  232.             function somewhere after the main message loop:
  233.  
  234.             FreeLibrary (hClrLib);
  235.  
  236.             This code releases the program's access to the DLL library.
  237.             The parts of the library that have been loaded into memory
  238.             can be discarded by Windows once no applications are still
  239.             accessing the library, so it is important that any
  240.             application that uses the DLL frees it during shutdown.
  241.  
  242.             Note that the hClrLib parameter needs to be the same value
  243.             as that returned from the call to LoadLibrary.  If the calls
  244.             are both made directly from WinMain, hClrLib can simply be a
  245.             local variable used in both calls.  If the calls are instead
  246.             made from subordinate functions defined in the application,
  247.             programmer needs to provide a way of keeping the value around
  248.             during the life of the program's execution.
  249.  
  250.       3.    Distribute the DLL with the application
  251.  
  252.             Since the DLL becomes a separate but integral part of the
  253.             application, it must be distributed with the application.
  254.             The rules for where Windows looks for the DLL file are
  255.             documented in the Windows SDK Guide to Programming, among
  256.             other places.  Normally, however, it is easiest to keep the
  257.             DLL in the same directory as the application's .EXE file.
  258.  
  259.       Accessing the OBJ Version
  260.       -------------------------
  261.  
  262.       An optional OBJ interface to the control is available to
  263.       registered users of this kit, which allows an application to
  264.       access the control's code without the need for including a
  265.       separate .DLL file with the application.
  266.  
  267.       Among the files included in the registered copy of this kit are
  268.       the CLRCTRLS.OBJ, CLRCTRLM.OBJ and CLRCTRLL.OBJ files.  Linking
  269.       one of these files directly into a small-, medium-, or large-
  270.       model application replaces all of the run-time functionality of
  271.       the control that is defined in the .DLL.
  272.  
  273.       The advantages of using the OBJ interface are:
  274.         - fewer files to add to the application's distribution kit
  275.           and copy during installation, especially when using many
  276.           custom controls
  277.         - less chance that the user will delete, misplace, or
  278.           overwrite the .DLL file, causing the application to fail
  279.  
  280.       The disadvantages of using the OBJ interface are:
  281.         - the application's .EXE file is larger
  282.         - the control's .OBJ file must be linked into the
  283.           application, in contrast to the pre-linked .DLL file
  284.           (which means that implementing new versions of the control
  285.           with the application requires a relink)
  286.         - the .DLL file may still need to be kept in the development
  287.           environment in order to allow using the Dialog Editor to
  288.           modify dialog boxes that use the control
  289.         - the .OBJ file used must match the memory model that the
  290.           application uses
  291.  
  292.       The following steps are necessary to implement access to the
  293.       control using the OBJ interface;  these steps replace the
  294.       above section, "Accessing the DLL":
  295.  
  296.       1.    Add a ClrCtrlRegisterClass() call
  297.  
  298.             ClrCtrlRegisterClass() should be called from WinMain
  299.             sometime during the program initialization process.
  300.             This function registers with Windows the special window
  301.             class that is needed by the color selector control.  The
  302.             function takes an argument that is the program's instance
  303.             handle, as in the following example:
  304.  
  305.                 ClrCtrlRegisterClass (hInstance);
  306.  
  307.       2.    Export the ClrCtrlWndProc() function
  308.  
  309.             Since the window procedure (ClrCtrlWndProc) for the color
  310.             selector control will be called by Windows' Dialog Manager
  311.             code, this function must be exported.  Add the function to
  312.             the list of exported functions in the application's .DEF
  313.             file, as in the following example:
  314.  
  315.                 EXPORTS
  316.                     ... various function names ...
  317.                     ClrCtrlWndProc
  318.                     ... various function names ...
  319.  
  320.       3.    Link the .OBJ file with the application
  321.  
  322.             Depending on the memory model used by the application,
  323.             link the proper .OBJ file (CLRCTRLS.OBJ, CLRCTRLM.OBJ,
  324.             or CLRCTRLL.OBJ) into the executable file for the
  325.             application.
  326.  
  327.       To implement a color selector in a dialog, refer to the
  328.       procedures in the following sections.
  329.  
  330.  
  331.       Using the Dialog Editor
  332.       -----------------------
  333.  
  334.       The easiest way to add color selector controls to an application's
  335.       dialog is to edit the dialog using the Dialog Editor found in the
  336.       Microsoft SDK.  The following paragraphs describe the steps 
  337.       necessary to add color selector controls to a dialog using the
  338.       Dialog Editor.
  339.  
  340.       Install the custom control library
  341.  
  342.       To access the color selector custom control from within the Dialog
  343.       Editor, the CLRCTRL.DLL file that defines the control must be 
  344.       "installed" in the Dialog Editor.  To do this, execute the Add
  345.       Custom Control menu option from the File menu of the Dialog
  346.       Editor, and give the full pathname of the control's .DLL file.
  347.       This pathname will point to wherever this custom control kit is
  348.       installed.
  349.  
  350.       If the .DLL file ever needs to be de-installed, use the Remove
  351.       Control option from the Dialog Editor's file menu, and choose the
  352.       control library to be removed from the list presented.
  353.       
  354.       Create a color selector in a dialog
  355.  
  356.       To use the color selector in a dialog, choose the Custom menu
  357.       option from the Control menu.  Then choose the CLRCTRL control
  358.       from the list presented.  The control also can be chosen from the
  359.       Toolbox, if it is displayed.  Once the control has been selected,
  360.       position the plus sign cursor where the upper left corner of the
  361.       control should be on the dialog, and click the left mouse button
  362.       to add the control.
  363.  
  364.       Modify the control in the dialog
  365.  
  366.       After adding a color selector to a dialog, it can be moved and 
  367.       resized in the same way as a standard control.  Keep in mind that
  368.       the size of the control is really larger than the visible portion
  369.       of the control, because of the drop-down area.  To make a color
  370.       selector the current object in the Dialog Editor, click the mouse
  371.       in the drop-down area, instead of in the visible area, because the
  372.       latter mouse click will be interpreted by the control and not the
  373.       Dialog Editor.
  374.  
  375.       Also, it is important to note how the vertical size of the control
  376.       affects the control.  The default vertical size of a color 
  377.       selector control is sixty dialog units.  At this size, the height
  378.       of the edit box and drop down button are the same as the height of
  379.       their standard Windows counterparts.  When dropped down, six color
  380.       rectangles are displayed (or fewer if there are less than six
  381.       color choices in the list.)  If the size of the control is changed
  382.       the size of the color rectangles and the size of the edit box and
  383.       drop down button also change.  There will still be six colors
  384.       displayed in the dropped down list.
  385.  
  386.       Within the Dialog Editor, the behavior is different.  If the size
  387.       of the control is changed and the dialog is then tested within the
  388.       Dialog Editor, the edit box and drop down button do not change
  389.       size.  In addition, the number of color rectangles displayed when
  390.       the list box is dropped down changes, instead of the size.  Keep 
  391.       this difference in mind when sizing the color selector controls
  392.       within a dialog.
  393.  
  394.       Control styles
  395.  
  396.       A color selector's ID value is the only "style" associated with
  397.       this type of control.  To modify this value, double-click the
  398.       mouse on the control or make the control the current object and
  399.       press Control-C.  Choosing the Styles menu option in the Edit menu
  400.       also works.  These actions cause the control's styles dialog box
  401.       to be presented, which has an edit field for the control's ID
  402.       value. This ID value field can be used in the same way as with a
  403.       standard control; a number can be entered or a string value can
  404.       be used that equates to a number using a #define in the header
  405.       file associated with the dialog.  See the SDK's Tools manual for
  406.       information on how to maintain a header file of ID values for the
  407.       dialog.
  408.  
  409.       Modifying the dialog by hand
  410.  
  411.       It is also possible to modify the dialog file without using the
  412.       Dialog Editor using a standard text editor.  A color selector
  413.       control in a dialog uses the CONTROL statement in the dialog file
  414.       and its format is the same as the CONTROL statement for a standard
  415.       control.  The class string for color selector's CONTROL statement
  416.       is "ClrCtrl" -- see the SDK tools manual for information on the
  417.       full format of the CONTROL statement.
  418.  
  419.       Dialog procedure handling
  420.       -------------------------
  421.  
  422.       To access a dialog's color selector control from the application,
  423.       code must be added to the dialog procedure to initialize the state
  424.       of the color selector and retrieve its current selected color at
  425.       the end of dialog processing.  To implement this access, perform
  426.       the following steps:
  427.  
  428.       1.    Include the color control header file.
  429.  
  430.             The header file for color selector control access,
  431.             clrctrl.h, should be included in any .c modules that define
  432.             dialogs using the color selector control.  This header file
  433.             defines message codes specific to the color selector and
  434.             other information useful to access the control.
  435.  
  436.       2.    Modify the color choices for the control.
  437.  
  438.             During WM_INITDIALOG message processing for the dialog, it
  439.             is possible to modify the color choices available in the
  440.             control.  To do this, the standard Windows messages for
  441.             modifying items in a combobox can be used.
  442.  
  443.             For the following examples, hClrCtrl is assumed to be an
  444.             HWND value, initialized to be a color selector's window
  445.             handle.  This value can be obtained in several ways, as
  446.             explained in any Windows programming reference.
  447.  
  448.             To add a color selection to the end of the control's list,
  449.             use the CB_ADDSTRING message.  For example,
  450.  
  451.             SendMessage(hClrCtrl, CB_ADDSTRING, 0, RGB(0xC0,0x40,0x00));
  452.  
  453.             will add an orange color to the end of the color selector's
  454.             list.  (Keep in mind that the color capability of the video
  455.             hardware that the application is being run on will determine
  456.             whether a particular RGB color is rendered as a pure color.)
  457.  
  458.             To remove a color choice from the list, determine the index
  459.             of the color in the list (starting at 0) and send the
  460.             CB_DELETESTRING message to the control.  For example,
  461.  
  462.             SendMessage (hClrCtrl, CB_DELETESTRING, 3, 0L);
  463.  
  464.             will remove the fourth color selection in the list.  Note
  465.             that removing an item will cause the indices assigned to all
  466.             colors below the removed color to be decremented by one, so
  467.             if more than one color selection is to be removed, it is
  468.             best to remove them from the bottom up.
  469.  
  470.             To insert a color choice in the middle of the list,
  471.             determine the index of the position at which to insert the
  472.             item and send the CB_INSERTSTRING message to the control.
  473.             For example,
  474.  
  475.             SendMessage (hClrCtrl, CB_INSERTSTRING, 7,
  476.                 RGB (0x80,0x00,0xFF));
  477.  
  478.             will insert a lavender color after the first seven colors
  479.             in the list.  Note that inserting an item will cause the
  480.             indices assigned to all colors below the inserted color to
  481.             be incremented by one, so if more than one color selection
  482.             is to be inserted, it is best to insert them from the bottom
  483.             up.
  484.             
  485.             For special situations, it may be desirable to remove all
  486.             color selections and then add back a complete set.  To do
  487.             this, send the CB_RESETCONTENT message to the control to
  488.             remove all current color selections in the list.  For
  489.             example,
  490.  
  491.             Sendmessage (hClrCtrl, CB_RESETCONTENT, 0, 0L);
  492.  
  493.             will remove all color selections.  (The last two parameters
  494.             are ignored.)
  495.  
  496.       3.    Set the default color choice for the control.
  497.  
  498.             During WM_INITDIALOG processing, it is also possible to
  499.             select the default color choice for a color selector.  This
  500.             can either be a hardcoded default choice, or it can be the
  501.             saved value of the choice that was selected during the last
  502.             time the dialog was processed.  If the index of the desired
  503.             default color choice is known, the CB_SETCURSEL message can
  504.             be sent to the control.  For example,
  505.  
  506.             SendMessage (hClrCtrl, CB_SETCURSEL, 6, 0L);
  507.  
  508.             sets the seventh color in the list as the default.
  509.  
  510.             If the RGB color value of the desired default color is known,
  511.             but the index of the color is not known, a special color
  512.             selector message, CLRM_SETCURCOLOR can be used.  For example,
  513.  
  514.             SendMessage (hClrCtrl, CLRM_SETCURCOLOR, 0,
  515.                 RGB (0xFF,0x00,0x00));
  516.  
  517.             sets the current color selection to be red.  Note that if
  518.             the exact RGB color specified does not exist in the control's
  519.             list, the current color selection will not be changed, and a
  520.             CB_ERR value will be returned.  (When a combobox control is
  521.             created, its initial current selection is index 0, until
  522.             changed by a message such as those above.)
  523.  
  524.       4.    Retrieve the current color choice when the dialog is closed.
  525.  
  526.             When a user action indicates that the current dialog control
  527.             values should be retrieved and used (such as when the user
  528.             presses an "OK" or "Apply" button), the current color value
  529.             for a color selector can be retrieved as an RGB value by
  530.             using the special color selector message, CLRM_GETCURCOLOR.
  531.             For example,
  532.  
  533.             COLORREF rgbColor;
  534.             . 
  535.             .
  536.             .
  537.             rgbColor = SendMessage (hClrCtrl, CLRM_GETCURCOLOR, 0, 0L);
  538.  
  539.             will store in rgbColor the current RGB color selected in the
  540.             control.  (The last two parameters are ignored.)
  541.  
  542.       Message handling
  543.       ----------------
  544.  
  545.       To make the color selector control as flexible as possible, most
  546.       of the standard Windows messages and notification codes that are
  547.       supported by a combobox control also are supported by the color
  548.       selector control.  The following sections contain further
  549.       information about this support.
  550.  
  551.       Color selector messages
  552.  
  553.       CLRM_GETCURCOLOR      retrieve the RGB color of the current
  554.                             selected item in the control.  wParam and
  555.                             lParam are not used.  The return value of
  556.                             the SendMessage call is the current selected
  557.                             RGB value.  See the previous section for
  558.                             information on using this message.
  559.       CLRM_SETCURCOLOR      set the current selected item of the control
  560.                             to the specified RGB color.  wParam is not
  561.                             used for this message.  lParam is used to
  562.                             pass the desired RGB color value.  The
  563.                             return value of the SendMessage call is
  564.                             CB_ERR if the specified RGB color is not in
  565.                             the control's list.  See the previous
  566.                             section for information on using this
  567.                             message.
  568.  
  569.       Windows messages
  570.  
  571.       The following Windows messages are supported in the color
  572.       selector control, either by special processing or by default
  573.       processing handled within Windows.  See the SDK Reference manual
  574.       (volume 2) for more information on these messages.
  575.  
  576.       WM_CREATE             create the control on the dialog
  577.       WM_DESTROY            remove the control from the dialog
  578.       WM_SIZE               resize the control
  579.       WM_PAINT              repaint the control
  580.       WM_COMMAND            process commands from the user
  581.       WM_ACTIVATE           activate or inactivate the control
  582.       WM_CHAR               process a keyboard character sent to the
  583.                             control
  584.       WM_ENABLE             enable or disable the control
  585.       WM_KEYDOWN            process a key press for a non-system key
  586.       WM_KEYUP              process a key release for a non-system key
  587.       WM_KILLFOCUS          remove the input focus from the control
  588.       WM_MOVE               move the control onthe dialog
  589.       WM_SETFOCUS           give the input focus to the control
  590.       WM_SYSCHAR            process a system keystroke sent to the
  591.                             control
  592.       WM_SYSKEYDOWN         process a key press for a system key
  593.       WM_SYSKEYUP           process a key release for a system key
  594.  
  595.       The control sends the following messages to its dialog parent:
  596.  
  597.       WM_CTLCOLOR           ask the dialog to change the drawing
  598.                             attributes used to paint the control (note
  599.                             that these attributes are used to draw the
  600.                             structural aspects of the control, and do
  601.                             not affect the color choices in the color
  602.                             selector's list)
  603.       WM_DELETEITEM         tell the dialog that a color choice has been
  604.                             removed from the color selector's list
  605.       
  606.       These messages control the comobox-specific aspects of the
  607.       color control:
  608.  
  609.       CB_ADDSTRING          add an item to the end of a combobox's list
  610.       CB_DELETESTRING       delete an item from a combobox's list
  611.       CB_GETCOUNT           determine the number of items in a combobox's
  612.                             list
  613.       CB_GETCURSEL          determine the index of the currently selected
  614.                             item in a combobox
  615.       CB_GETITEMDATA        retrieve the data associated with an item in
  616.                             a combobox (for color selectors, this data is
  617.                             the stored RGB color value)
  618.       CB_INSERTSTRING       insert an item in the middle of a combobox's
  619.                             list
  620.       CB_RESETCONTENT       remove all items from a combobox's list
  621.       CB_SETITEMDATA        store a data value in a combobox item (for
  622.                             color selectors, this data is the RGB color
  623.                             value)
  624.       CB_SETCURSEL          change the currently selected item in a
  625.                             combobox
  626.  
  627.       Windows notification codes
  628.  
  629.       The color selector control returns the following combobox
  630.       notification codes to its parent window, in WM_COMMAND messages:
  631.  
  632.       See the SDK Reference manual (volume 2) for more information on
  633.       these codes.
  634.  
  635.       CBN_DROPDOWN          notify the dialog that the color selector
  636.                             listbox has been dropped down
  637.       CBN_KILLFOCUS         notify the dialog that the color selector
  638.                             control has lost the input focus
  639.       CBN_SELCHANGE         notify the dialog that the color selector
  640.                             current color has changed
  641.       CBN_SETFOCUS          notify the dialog that the color selector
  642.                             control has gained the input focus
  643.       CBN_EDITCHANGE        notify the dialog that the color selector
  644.                             control's edit box value may have changed
  645.       CBN_EDITUPDATE        notify the dialog that the color selector
  646.                             control's edit box value will be changed
  647.  
  648.       SAMPLE PROGRAM
  649.  
  650.       This kit comes with a sample Windows program, CLRTEST.EXE.  This
  651.       program serves two purposes: first, it provides a good test of most
  652.       of the important functionality of the control and the interface
  653.       between the control and the application that uses it; second, it
  654.       represents a clean example of the control's implementation and use
  655.       in a program, without any complicated "applicaton-specific" code to
  656.       get in the way.  Other than that, this program does not do any
  657.       useful work--it is unlikely that anyone will want add it to one of
  658.       their Program Manager groups!  On the other hand, it may come in
  659.       handy as a starting point for testing special ways of interfacing
  660.       with the control, whenever changes to the control's standard
  661.       behavior are desired.
  662.  
  663.       Using the sample program
  664.       ------------------------
  665.  
  666.       Using the CLRTEST.EXE program is easy.  When run, the program
  667.       consists of a normal application window and a short application
  668.       menu.  The window contains a line of sample text that is colored
  669.       according to a default color value defined in the test program,
  670.       displayed on a background that is colored by another default color
  671.       value.  The application menu is described below.
  672.  
  673.       Application menu
  674.  
  675.       The test program's application menu contains three choices:  File,
  676.       Options, and Help.
  677.  
  678.       File menu
  679.  
  680.       The File menu has a standard meaning on most Windows applications,
  681.       but in this program, only one standard File menu option is
  682.       defined: Exit.  When Exit is chosen, the program simply shuts down.
  683.  
  684.       Options menu
  685.  
  686.       Under the Options menu, there is one option: Test Color Selector.
  687.       This option displays the "Color Test Attributes" dialog.
  688.  
  689.       Color Test Attributes Dialog
  690.  
  691.       This dialog is used to test the functionality of the color selector
  692.       control.  It contains a color selector control for "text color" and
  693.       one for "background color."  Changing the currently selected color
  694.       in either of these controls changes the corresponding current color
  695.       attribute for the program.  The pushbuttons on the dialog work in
  696.       the expected way: The OK button causes the main application window
  697.       to be redrawn using the current colors choices in the color
  698.       selectors.  The Cancel button leaves the current color settings for
  699.       the program as they were before the dialog box was displayed.  The
  700.       Reset button resets the current colors in the controls to the
  701.       default values defined in the program code.
  702.  
  703.       Note that each color selector has had colors added or removed from
  704.       the default set of sixteen pure colors.  The standard Dark Magenta
  705.       pure color has been removed from the text color selector, and a
  706.       sky-blue color has been added in the fourth position in the list.
  707.       Also, an orangish color has been added to the end of the background
  708.       color selector's list.  This is to test (and illustrate) the
  709.       ability to modify the control's behavior with standard Windows
  710.       messages, as standard controls (including comboboxes) allow.
  711.  
  712.       Help menu
  713.  
  714.       The help menu provides access to the Windows help file for the
  715.       CLRCTRL kit, which is an enhanced version of this text.  Besides
  716.       help information for the test program, it contains information
  717.       about using the color selector control in other applications.  In
  718.       addition, an "About Color Test..." option is defined, which
  719.       provides general information about the kit.
  720.  
  721.  
  722.       REGISTRATION
  723.  
  724.       This software product is SHAREWARE.  You are permitted to evaluate
  725.       this software product for a period of 30 days.  If, after that
  726.       period, you find the software product useful, you must register the
  727.       software product and send $15 with your name and address to the
  728.       address shown at the top of this text.  You will then receive a
  729.       registered copy of the kit, including the files necessary to use
  730.       the OBJ interface to the control.  You will also be entitled to
  731.       receive a registered copy of the next major revision of this
  732.       software product plus technical support at no charge.
  733.  
  734.       You may also make additional copies for the purpose of allowing
  735.       others to evaluate the software product, as long as no
  736.       modifications or additions are made to the software, its
  737.       documentation, or any associated files, and this kit is not bundled
  738.       in a distribution of any other software except that which is
  739.       distributed as Shareware or Public Domain.
  740.  
  741.       Since this product is a programmer's kit, the RUN-TIME version of
  742.       this product, which consists of the .DLL file alone plus code
  743.       compiled against the .H file, may be distributed as part of a
  744.       RUN-TIME ONLY distribution of a commercial, shareware, or public
  745.       domain application.
  746.  
  747.       In the case of the OBJ interface to the code, the run-time portion
  748.       of the product consists of the appropriate .OBJ file for the
  749.       control, plus code compiled against the .H file.
  750.  
  751.  
  752.       FEEDBACK
  753.  
  754.       Lastly, if you find this software product useful and have any
  755.       interesting comments or ideas on how it might be improved,
  756.       please let me know!  I will attempt to incorporate the best of
  757.       these suggestions in future versions of this software product.
  758.       And, if you happen to provide particularly valuable feedback, I
  759.       will, at my discretion, register you free of charge.
  760.  
  761.       Also, watch for other custom controls to be available as shareware
  762.       soon.  If I get a positive response from this product, I have many
  763.       more that I will upload in the future!
  764.  
  765.       Thanks again for evaluating this product!
  766.  
  767.  
  768.       DISCLAIMER
  769.  
  770.       This software product is made available on an "as is" basis,
  771.       and carries no warranties, express or implied, including, but not
  772.       limited to, merchantability or fitness for a particular purpose.
  773.       The author shall in no way be held liable for any damages resulting
  774.       from the use of this software product or the media on which it is
  775.       distributed, including, without limitation, loss of business
  776.       profits, interruption of business, loss of information, damage to
  777.       equipment, or any other incidental or consequential damages.
  778.