This project is provided with the PJSoft Colour Popup Menu component to demonstrate how to use the component.
The demo project is provided in the same zip file as the main component. Follow
the installation instructions supplied with the zip file (pjcmenu.htm
).
Ensure that the component is installed before attempting to compile the demo
project. The demo was created with Delphi 4.
The demo program contains a copy of the PJColourPopupMenu component and provides access to its properties via the user interface. When the program starts the component has its default values and the program appears as follows:
The window is divided into three main areas:
The values of several of the most important properties are displayed in the controls in the Component properties group box. They are:
Display style |
Determines how the component displays the colours. Options are:
Test the various styles by chosing different ones from the Display style drop-down list. |
Menu columns |
Determines how many columns are used to display the menu. Options are:
|
Check selected colour | When this check box is checked the the curently selected colour is checked (or highlighted) in the menu. |
Bitmap height | Only used if the Display Style is Colour only. Determines the height of the bitmap used to represent the colour in the palette. |
Bitmap width | Only used if the Display Style is Colour only. Determines the width of the bitmap used to represent the colour in the palette. |
By handling the component's OnCreateMenuItem event you can change the colour menu items as required. This should be done with care since the component requires some of the menu item properties to have expected values in order to work properly. However, some properties can be modified safely -- look up the OnCreateMenuItem event component's help file for details.
The demo program has two modifications that can be applied to the test menu. They are:
Show colours as round |
Checking this check box causes round colour swatches to appear next to the colour name when the Text and colour display style is used. |
Display colour identifiers |
Checking this check box replaces the default menu text (the names of colours) with the Delphi colour constant names. This happens for all display styles except Colour only. A real life use of this facility would be to translate the colour names into another language. |