[Overview][Constants][Types][Classes][Procedures and functions][Index] |
OnGetColors - event handler for the instruction to get colors.
Source position: colorbox.pas line 216
public property TCustomColorListBox.OnGetColors : TLBGetColorsEvent |
OnGetColors is a TGetColorsEvent property with the event handler signalled to get custom colors used in the list box control.
An application must implement and assign an object procedure using the signature in TGetColorsEvent to respond to the notification. Sender is the TCustomColorBox control for the event notification. Items is the TStrings instance with the existing color names and values stored in the control.
The event handler can perform any actions needed to populate the list of Items. This can include clearing the Items, adding or removing selected names and color values, or using color names and/or values not defined as color constants in the graphics.pp unit. It could also be used to implement a custom color palette with specific pre-defined color combinations.
Some common operations:
Clear the list of ltems:
Items.Clear;
Add a specific color:
Items.AddObject(rsSkyBlueColorCaption, TObject(PtrInt(clSkyBlue)));
Delete a specific color:
iPos := Items.IndexOf(rsSkyBlueColorCaption); if iPos <> -1 then Items.Delete(iPos);
OnGetColors is signalled (when assigned) when the color list is loaded for the control, and cbCustomColors has been included in the Style for the control. This occurs when a new value is assigned to the Style property.
Version 4.0 | Generated 2025-05-03 | Home |