Colour Pop-up Menu Component
|Date:||17 August 2008|
Development of the Colour Popup Menu is frozen.
This component was originally written back in 2001 when I needed a simple colour menu component for an app I was writing. That was in the pre-XP, pre-themes days and the component has never been updated to adopt the modern (XP, Vista and later) look and feel and so now looks rather dated.
I have no further need for the component and it would be quite a lot of work to make it themes-aware. Given that there are much better colour menu components out there, it just doesn't seem worth the effort. So I've decided to abandon the project. I'll be leaving the code on the site but will not be updating it.
If you want to take on maintenance please go ahead. The download page provides everything you need. The source code is covered by the Mozilla Public License v1.1. I'd be interested to know about any changes that are made to the component.
The colour menu component, TPJColourPopupMenu, is an open source non-visual component that descends from TPopupMenu. It implements a pop-up menu that gives access to the 16 basic Windows colours. The menu can be displayed over one, two, four or eight columns. It can also be displayed in one of the four following styles:
- Text only – the menu displays a just a textual description of the colour.
- Text and colour – the menu displays text describing the colour along with a small bitmap illustrating the colour.
- Colour only – colour swatches are displayed without any text (like a palette).
- Owner draw – the user provides code that draws the menu items.
The textual descriptions of colours are in English. However, it is easy to provide names in other languages or use Delphi colour identifiers etc. This is done by handling one of the component's events. The accompanying demo program shows how to do this.
Here are three examples of how the menu can appear:
Text and Colour
Included with the component in the download are:
- A help file that can integrate with the Delphi 4-7 IDE.
- Two property editors required by the component – one to prevent editing of the Items property and the other to limit the SelectedColour property to 16 basic colours.
A component editor (accessed from a mouse menu when the component is selected) that gives easy access to all the component's main properties. Here is a screenshot of the component editor:
- A demo project showing how to use the component.