Class TIconComboBox (unit IconCtls)

Inherits from

TCustomComboBox

Constructors


constructor Create(AOwner: TComponent);

TIconComboBox Component


Functions

procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);

Draw the item requested in the given rectangle.

function GetIcon(const Index: integer): TIcon;

Returns the icon for a given combobox index

function GetVersion: TDFSVersion;

If anything went wrong, we fall down to here.

procedure MeasureItem(Index: Integer; var Height: Integer);

Owner drawing routines

Return the size of the item we are drawing


function ReadIcon(const Index: integer): TIcon;

Icon service routines

Used to extract icons from files and assign them to a TIcon object


procedure SetAutoDisable(Value: boolean);

Update the AutoDisable property

procedure SetEnableCaching(Value: boolean);

Update the EnableCaching property

procedure SetFileName(Value: String);

Routines for setting property values and updating affected items

Update the filename of the icon file.


procedure SetVersion(const Val: TDFSVersion);


procedure FreeIcons;

Free the icon resources we created.

procedure LoadIcons;

Routines that should only be used internally by component

Initialize the icon handles, which are stored in the Objects property


procedure UpdateEnabledState;

Disable the control if we don't have a valid filename, and option is enabled

procedure WMDeleteItem(var Msg: TWMDeleteItem);

Set default values

Properties

property AutoDisable : boolean

If true, the combobox will be disabled when FileName does not exist

property Color :

Protected properties in parent that we will make available to everyone

property Ctl3D :


property DragCursor :


property DragMode :


property DropDownCount :


property EnableCaching : boolean

If true, icons will be loaded as needed, instead of all at once

property Enabled :


property FileName : string

Name of icon file to display

property ItemIndex :


property NumberOfIcons : integer

The number of icons in the file.

property ParentColor :


property ParentCtl3D :


property ParentFont :


property ParentShowHint :


property PopupMenu :


property ShowHint :


property TabOrder :


property TabStop :


property Version : TDFSVersion


property Visible :


Events

event OnClick :

property OnChange: TNotifyEvent read FOnChange write FOnChange;

event OnDblClick :


event OnDragDrop :


event OnDragOver :


event OnDropDown :


event OnEndDrag :


event OnEnter :


event OnExit :


event OnFileChange : TNotifyEvent

Useful if you have statics the reflect the number of icons, etc.

event OnKeyDown :


event OnKeyPress :


event OnKeyUp :


Variables

FAutoDisable : boolean;


FEnableCaching : boolean;


FFileName : String;

Variables for properties

FNumberOfIcons : integer;


FOnFileChange : TNotifyEvent;



Constructors


constructor Create(AOwner: TComponent);

TIconComboBox Component


Functions


procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);

Draw the item requested in the given rectangle. Because of the parent's default } { behavior, we needn't worry about the State. That's very nice.


function GetIcon(const Index: integer): TIcon;

Returns the icon for a given combobox index


function GetVersion: TDFSVersion;

If anything went wrong, we fall down to here. You may want to add some } { sort of user notification. No clean up is necessary since we did not } { create anything. We'll just ignore the problem and hope it goes away. :) } {!


procedure MeasureItem(Index: Integer; var Height: Integer);

Owner drawing routines

Return the size of the item we are drawing


function ReadIcon(const Index: integer): TIcon;

Icon service routines

Used to extract icons from files and assign them to a TIcon object


procedure SetAutoDisable(Value: boolean);

Update the AutoDisable property


procedure SetEnableCaching(Value: boolean);

Update the EnableCaching property


procedure SetFileName(Value: String);

Routines for setting property values and updating affected items

Update the filename of the icon file.


procedure SetVersion(const Val: TDFSVersion);


procedure FreeIcons;

Free the icon resources we created.


procedure LoadIcons;

Routines that should only be used internally by component

Initialize the icon handles, which are stored in the Objects property


procedure UpdateEnabledState;

Disable the control if we don't have a valid filename, and option is enabled


procedure WMDeleteItem(var Msg: TWMDeleteItem);

Set default values


Properties


property AutoDisable : boolean

If true, the combobox will be disabled when FileName does not exist


property Color :

Protected properties in parent that we will make available to everyone


property Ctl3D :


property DragCursor :


property DragMode :


property DropDownCount :


property EnableCaching : boolean

If true, icons will be loaded as needed, instead of all at once


property Enabled :


property FileName : string

Name of icon file to display


property ItemIndex :


property NumberOfIcons : integer

The number of icons in the file. -1 if FileName is not valid.


property ParentColor :


property ParentCtl3D :


property ParentFont :


property ParentShowHint :


property PopupMenu :


property ShowHint :


property TabOrder :


property TabStop :


property Version : TDFSVersion


property Visible :


Events


event OnClick :

property OnChange: TNotifyEvent read FOnChange write FOnChange;


event OnDblClick :


event OnDragDrop :


event OnDragOver :


event OnDropDown :


event OnEndDrag :


event OnEnter :


event OnExit :


event OnFileChange : TNotifyEvent

Useful if you have statics the reflect the number of icons, etc.


event OnKeyDown :


event OnKeyPress :


event OnKeyUp :


Variables


FAutoDisable : boolean;


FEnableCaching : boolean;


FFileName : String;

Variables for properties


FNumberOfIcons : integer;


FOnFileChange : TNotifyEvent;