«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

Colour Pop-up Menu Component

Release: 1.2
Date: 17 August 2008
Delphi Compatibility:
D1 D2 D3 D4 D5 D6 D7 D2005 D2006 D2007 D2009 D2010 DXE DXE2 DXE3 DXE4
Red LED Red LED Red LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Grey LED Grey LED Grey LED Grey LED



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 only
(2 columns)
Colour only
(4 columns)
Text and Colour
(2 columns)
Screenshot of TPJColourPopupMenu text only example Screenshot of TPJColourPopupMenu colour only example Screenshot of TPJColourPopupMenu text and colour example

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:
    Screenshot of colour menu component editor
  • A demo project showing how to use the component.