[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Dialogs' (#lcl)

TColorButton

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TColorButton - a SpeedButton designed to be used with the Color dialog, allowing a colour to be selected for text or graphics

Declaration

Source position: dialogs.pp line 255

type TColorButton = class(TCustomSpeedButton)

  class procedure WSRegisterClass; override;

  

WSRegisterClass - Register this Class for the current Widget Set

protected

  function DrawGlyph(); override;

  

DrawGlyph - draw the glyph on the button face

  function GetDisabledPattern; virtual;

  

GetDisabledPattern - returns a BitMap with a disabled pattern

  function GetGlyphSize(); override;

  

GetGlyphSize - returns the value of the size for glyphs on the button

protected

  class function GetControlClassDefaultSize; override;

  

Find the default size for this class of controls (by reference to parents)

protected

  procedure ShowColorDialog; virtual;

  

ShowColorDialog - method for displaying the Colour dialog

public

  constructor Create(); override;

  

Create - constructor for TColorButton; calls inherited Create , sets initial bounds, size and pattern

  destructor Destroy; override;

  

Destroy - destructor for TCustomSpeedButton: frees Glyph then calls inherited Destroy

  procedure Click; override;

  

Click - a procedure that allows the programmer to simulate a mouse click over the control, and initiates the same Action as that associated with the OnClick event

published

  property Action;

  

The action to be associated with this control

  property Align;

  

Used to align the control to the top, bottom, left or right of its client.

  property Anchors;

  

The set of anchor definitions for this control

  property AllowAllUp;

  

Boolean flag to determine whether all buttons are allowed to be Up (default false)

  property BorderSpacing;

  

Determines the border spacing for this control

  property BorderWidth: Integer; [rw]

  

BorderWidth - the width of the button's borders

  property ButtonColorAutoSize: Boolean; [rws]

  

ButtonColorAutoSize - returns True if the block displaying button colour is to be autosized

  property ButtonColorSize: Integer; [rw]

  

ButtonColorSize - the size of the button colour block

  property ButtonColor: TColor; [rw]

  

ButtonColor - the colour that has been selected by the ColorDialog and is displayed in the button

  property ColorDialog: TColorDialog; [rw]

  

The ColorDialog that opens when the button is activated

  property Constraints;

  

Determine Constraints (max and min height and width) for this control

  property Caption;

  

Caption - a string that can be placed beside the block of colour

  property Color;

  

The Color of the control itself, ie the parts that are not the colour display block; edges, background etc

  property Down;

  

The button has been set in the Down state

  property Enabled;

  

Whether the control is Enabled (read/write). If not, it usually appears 'greyed-out'

  property Flat;

  

Whether the button is to be displayed Flat or in relief

  property Font;

  

The font to be used for text in this control (read/write).

  property GroupIndex;

  

The Index within the group of speedbuttons

  property Hint;

  

Hint - a small informative pop-up box that appears when the mouse 'hovers' over a control

  property Layout;

  

The button layout - Glyph at top, bottom, left or right

  property Margin;

  

Margin - the space around glyphs

  property Spacing;

  

Spacing around button

  property Transparent;

  

Whether button is transparent

  property Visible;

  

Visible - can the control be seen?

  property OnClick;

  

Event Handler for mouse click

  property OnColorChanged: TNotifyEvent; [rw]

  

OnColorChanged - event handler for a change in button colour

  property OnDblClick;

  

Event Handle for mouse double-click

  property OnMouseDown;

  

Event handler for when a mouse button is pressed down

  property OnMouseMove;

  

Event handler for mouse movement within the current control

  property OnMouseUp;

  

Event handler for when the mouse button is released, ie "up"

  property OnPaint;

  

OnPaint - event handler for request to paint canvas

  property OnResize;

  

Event Handler for resize of control

  property OnChangeBounds;

  

Event handler for a change in bounds of the control

  property ShowHint;

  

Flag to determine: Is hint to be displayed for this control?

  property ParentFont;

  

ParentFont - should the control use the same font as the parent? Default is true

  property ParentShowHint;

  

ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true

  property PopupMenu;

  

PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control

end;

Inheritance

TColorButton

  

TColorButton - a SpeedButton designed to be used with the Color dialog, allowing a colour to be selected for text or graphics

|

TCustomSpeedButton

  

The ancestor class for TSpeedButton

|

TGraphicControl

  

TGraphicControl is the base class for all lightweight controls.

|

TControl

|

TLCLComponent

  

TLCLComponent - base class for LCL components

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent

|

TObject

Description

TColorButton - a SpeedButton designed to be used with the Color dialog, allowing a colour to be selected for text or graphics

To use the ColorButton, first select the ColorButton icon from the Component Palette and place it on the Form Designer in the location you want it to occupy, then place a TColorDialog on the Form Designer, give it a name (or accept the default name) and select this named dialog as the ColorDialog property in the Object Inspector for the ColorButton.

The default appearance of the ColorButton is a rectangle containing a colour; if you wish to include a caption beside the block of colour, you may need to adjust the size of the control to accommodate the text, and you can then enter some text in the Caption property of the ColorButton; this text will appear next to the colour block.

After compilation, at runtime the ColorButton is visible with a default or preselected ButtonColor in the block, and any optional caption beside it; the ColorDialog is not visible until the ColorButton is clicked, when the ColorDialog pops up and offers a choice of colours, either from a list or a palette, and if the user makes a selection and closes the dialog by pressing OK, the ColorButton will display the colour that was chosen in the ColorDialog

Note that in the context of ColorButton, properties with the name ButtonColor refer to the colour that has been selected and is displayed in the colour block; properties entitled Color without 'Button' attached refer to the colour of the control itself, usually the same as the background or the default button face colour

The latest version of this document can be found at lazarus-ccr.sourceforge.net.