[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 268

type TColorButton = class(TCustomSpeedButton) end;

protected

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  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

  class function GetControlClassDefaultSize; override;

  

Returns the default size for this class of controls (when added to a form).

  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;

  

Invokes the OnClick and ActionLink.Execute handlers.

published

  property Action: TBasicAction;

  

The Action associated with this control.

  property Align: TAlign;

  

Specifies the placement of the control inside its Parent.

  property Anchors: TAnchors;

  

The set of anchor definitions for this control.

  property AllowAllUp: Boolean;

  

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

  property BorderSpacing: TControlBorderSpacing;

  

Determines the inner and outer 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: TSizeConstraints;

  

The minimal and maximal Width and Height of this control.

  property Caption: TCaption;

  

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

  property Color: TColor;

  

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

  property Down: Boolean;

  

The button has been set in the Down state

  property Enabled: Boolean;

  

Determines whether the control reacts on mouse or keyboard input.

  property Flat: Boolean;

  

Whether the button is to be displayed Flat or in relief

  property Font: TFont;

  

The font to be used for text display in this control.

  property GroupIndex: Integer;

  

The Index within the group of speedbuttons

  property Hint: TTranslateString;

  

The text to show in the Hint window for this control.

  property Layout: TButtonLayout;

  

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

  property Margin: Integer;

  

Margin - the space around glyph and caption

  property Spacing: Integer;

  

Spacing between Glyph and Caption

  property Transparent: Boolean;

  

Whether button is transparent

  property Visible: Boolean;

  

Allows to show or hide the control, and all of its children.

  property OnClick: TNotifyEvent;

  

Notification handler for mouse clicks.

  property OnColorChanged: TNotifyEvent; [rw]

  

OnColorChanged - event handler for a change in button colour

  property OnDblClick: TNotifyEvent;

  

Event Handler for double mouse clicks.

  property OnMouseDown: TMouseEvent;

  

Event handler for mouse button going down.

  property OnMouseEnter: TNotifyEvent;

  property OnMouseLeave: TNotifyEvent;

  property OnMouseMove: TMouseMoveEvent;

  

Event handler for mouse movement within the control.

  property OnMouseUp: TMouseEvent;

  

Event handler for mouse button going up.

  property OnMouseWheel: TMouseWheelEvent;

  property OnMouseWheelDown: TMouseWheelUpDownEvent;

  property OnMouseWheelUp: TMouseWheelUpDownEvent;

  property OnPaint: TNotifyEvent;

  

Supply your own OnPaint handler for painting the control.

  property OnResize: TNotifyEvent;

  

Notification handler for a resize of the control.

  property OnChangeBounds: TNotifyEvent;

  

Event handler for a change of the Bounds of the control.

  property ShowHint: Boolean;

  

Enables the Hint display.

  property ParentFont: Boolean;

  

If true, the Font of the control will be the same as the one from the Parent. Default is true.

  property ParentShowHint: Boolean;

  

If true, the value of ShowHint for the control will be the same as the one from the Parent. Default is true.

  property PopupMenu: TPopupMenu;

  

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

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

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

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.