GUI ScreenIO for Windows |
The ChooseColor API launches the Choose Color common dialog which allows the user to select one colors from the standard windows dialog.
The use of the ChooseColor API is beyond the scope of a typical GUI ScreenIO application. ChooseColor is used by the GUI ScreenIO panel editor but is of limited use to you in your application, since you can't change colors in this method on-the-fly. Use the Named Color Table to change colors of controls at run time instead of this api.
This may be useful for selecting colors for print items if you are doing low-level printing.
See the Microsoft Windows documentation if you intend to use this API.
No issues; this API will behave as if it were running locally on the client.
Files available to copy to your system:
COPY WIN32API. COPY CHOOSCLR. MOVE mymain-HINSTANCE TO CHOOSECOLOR-HINSTANCE. MOVE mypanel-HWND TO CHOOSECOLOR-HWNDOWNER. * * ------------------------: Set the flag bits by adding the * : values, giving CHOOSECOLOR-FLAGS. * : These are the useful ones. * * : Initializes selection to that passed * CC-RGBINIT VALUE H'00000001'. * : Offers only nondithered colors * CC-SOLIDCOLOR VALUE H'00000080'. * : Offers all colors * CC-ANYCOLOR VALUE H'00000100'. * : Displays controls for custom colors * : (no need to press the button) * CC-FULLOPEN VALUE H'00000002'. * : Prevents use of custom colors button * CC-PREVENTFULLOPEN VALUE H'00000004'. * ADD CC-RGBINIT CC-SOLIDCOLOR CC-FULLOPEN GIVING CHOOSECOLOR-FLAGS. SET API-CHOOSECOLOR TO TRUE * ------------------------: Call the GUI ScreenIO API routine: * CALL 'GSWINAPI' USING WIN32API-PARMS CHOOSECOLOR-PARMS CHOOSECOLOR-CUSTOMCOLORS WIN32API-C WIN32API-D WIN32API-E WIN32API-F. IF WIN32API-FAILED do no-color-found ELSE color specifications are returned... |
Instance handle of your application, from your main panel.
Handle of the owner window; panel-HWND. (Can be low values)
Flags used to initialize the COLOR dialog box.
A combination of bit flags that specify various options used to initialize the common dialog.
You OR these values to specify the bit values used for CHOOSECOLOR-FLAGS. You can ADD them together as shown in the code sample above.
Flag | Value | Description |
CC-RGBINIT | 1h | Initializes the selected color to what was passed in. Otherwise Black is usually selected. |
CC-SOLIDCOLOR | 80h | Shows only solid colors (not dithered). |
CC-ANYCOLOR | 100h | Allows use of the Customized Color portion of the dialog. |
CC-FULLOPEN | 2h | Automatically displays the Custom Color portion of the dialog without the user needing to select it |
CC-PREVENTFULLOPEN | 4h | Prevents the option to open the custom color dialog. |
This is the selected four byte color value that the user chose. This color is IN WINDOWS NATIVE FORMAT AND MAY NOT BE USES TO CHANGE THE COLOR OF GUI SCREENIO FIELDS.
An array of up to 16 custom colors that your user pre-configured. If you retain this area, this same list of custom colors will be offered upon the next display of the dialog box.
This argument is standard for all CALLs to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.
Used to return the status of a call to GSWINAPI. A value of zero is a failure, any other value indicates success.
Recommended usage is to test the 88-level value WIN32API to see if it worked, then to use the text error message to see why it failed.
* ------------------------: If function failed,
|
Error code that was returned by Windows. This is not generally useful unless you have the Windows Platform SDK documentation available to you.
Plain-text error message that describes why the operation failed.
The number of these present varies depending on how many arguments are used by the desired function. These are not used, but must be present because this CALL requires seven arguments.
© 2000-2019 Norcom, all rights reserved |