Products · Orders · Downloads · Support · Fixes · Free Stuff · Company · News · Home
Free Stuff - ChooseColor() Template 
Please Note: This item may not be re-packaged for sale or profit as an add-on to Clarion although you are free to use it within your applications and products and may freely distribute it to other Clarion developers if provided free of charge and prefaced with this notice.

Although usable by anyone who wants to provide a ColorDialog() that's always expanded, this work was originally done for an RPM user that needed a translated color picker for the Viewer Preferences dialog in RPM as well as other uses of ColorDialog() within his application.

Download includes:
   
LSi-ColorDlg.TPL This template writes source into your EXE application.
Example.APP Dirt simple C6.1.9033 APP file.
Color.DLG Default ChooseColor template file (ASCII)
ExampleColor.DLG My strange ChooseColor template (ASCII) [see results below]
ExampleColor.RES The compiled resource file from my template
   

As written this template should only be used in the APP file that generates your EXE whether a single EXE or a multi-DLL application. (sample of generated source)

The Clarion runtime library uses a compiled color dialog template which prevents the OS from displaying a translated dialog. The template, and source, provided in this project diverts ColorDialog() to a hooked procedure that opens the ChooseColor() common dialog within the OS. By doing this direct call the OS presents the user with a color dialog fitting the current users language and preferences.

ExampleColor.DLG, as with any dialog template, is a simple ASCII file. You can open it with TextPad or Notepad or the Clarion editor. To use your own customized template you will need a resource compiler and the requisite windows header files. Once you have compiled your resource you can include it in your application. Just remember that once you use a template all translation is your responsibility. The strange template I created (show below) makes several changes to the default dialog text and removes the "Define Custom Colors" button. It also widens the "OK" button which now says "Okey Dokey".

The reason the Clarion RTL uses a template is purely a shortcoming of design as a result of the original ColorDialog() providing a drop down list of standard colors as seen here ...

 

By doing a direct call to the ChooseColor( ) common dialog you can get these results ...

No template default dialog with automatic translation (opens expanded)

No template default dialog with custom caption (opens expanded)

 
 
 
Template used:
- Notice customized caption!
- Notice changes in text
- Notice lack of "Define Custom Colors" button
(opens expanded)

Template used (as above) but with custom caption (opens expanded)

It's all source within the template. Customize as you see fit and enjoy!

 

 
 
Products · Orders · Downloads · Support · Fixes · Free Stuff · Company · News · Home


Copyright© 2007, DeveloperPLUS.
"Clarion Add-ons" and the "Clarion Add-ons" logo are trademarks of DeveloperPLUS.
(legal)