[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 color to be selected for text or graphics.

Declaration

Source position: dialogs.pp line 294

type TColorButton = class(TCustomSpeedButton)

protected

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  function DrawGlyph(); override;

  

Re-implements drawing the glyph for the control to use the selected color.

  function GetDisabledPattern; virtual;

  

Gets a bitmap with the disabled pattern for the control.

  function GetGlyphSize(); override;

  

Gets the size for the glyph (color block / swatch) on the button control.

  class function GetControlClassDefaultSize; override;

  

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

  procedure Notification(); override;

  

Performs actions when the specified component is added to or removed from the control.

  procedure ShowColorDialog; virtual;

  

Displays a Color dialog and captures its result.

public

  constructor Create(); override;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destructor for the class instance.

  procedure Click; override;

  

Performs actions needed when the control is clicked.

published

  property Action: TBasicAction;

  

The Action associated with the 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 which indicates if all buttons in a group are allowed to be Up (default is False).

  property BorderSpacing: TControlBorderSpacing;

  

Determines the inner and outer border spacing for this control.

  property BorderWidth: Integer; [rw]

  

Width for the borders on the button control.

  property ButtonColorAutoSize: Boolean; [rws]

  

True if the color block for the button can be automatically resized to fill the unused client area.

  property ButtonColorSize: Integer; [rw]

  

Size of the color block (or swatch) on the button control.

  property ButtonColor: TColor; [rw]

  

The TColor value selected in the button control.

  property ColorDialog: TColorDialog; [rw]

  

The color selection dialog displayed when the control is clicked, or the ShowColorDialog method is called.

  property Constraints: TSizeConstraints;

  

The minimum and maximum Width and Height for the control.

  property Caption: TCaption;

  

Text displayed next to the color block on the button control.

  property Color: TColor;

  

The Color of the control itself, i.e. the parts that are not the color display block; edges, background etc.

  property Down: Boolean;

  

Indicates if the button has been set to 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;

  property Hint: TTranslateString;

  

The text to show in the Hint window for the 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;

  

Indicates if the control is drawn with transparency.

  property Visible: Boolean;

  

Allows the control, and all of its children, to be displayed or hidden.

  property OnClick: TNotifyEvent;

  

Notification handler for mouse clicks.

  property OnColorChanged: TNotifyEvent; [rw]

  

Event handler signalled when the button color has been changed.

  property OnDblClick: TNotifyEvent;

  

Event Handler for double mouse clicks.

  property OnMouseDown: TMouseEvent;

  

Event handler for mouse button going down.

  property OnMouseEnter: TNotifyEvent;

  

Event handler for mouse entering the area of the control.

  property OnMouseLeave: TNotifyEvent;

  

Event handler for mouse leaving the area of the control.

  property OnMouseMove: TMouseMoveEvent;

  

Event handler for mouse movement within the control.

  property OnMouseUp: TMouseEvent;

  

Event handler for mouse button going up.

  property OnMouseWheel: TMouseWheelEvent;

  

Event handler for mouse wheel turned.

  property OnMouseWheelDown: TMouseWheelUpDownEvent;

  

Event handler for downward movement of mouse wheel.

  property OnMouseWheelUp: TMouseWheelUpDownEvent;

  

Event handler for upward movement of the mouse wheel.

  property OnPaint: TNotifyEvent;

  

Event handler signalled to paint 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.

end;

Inheritance

TColorButton

  

TColorButton - a SpeedButton designed to be used with the Color dialog, allowing a color 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 which have an associated widget.

|

TComponent

?

TObject

Description

TColorButton - a SpeedButton designed to be used with the Color dialog, allowing a color 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 color; if you wish to include a caption beside the block of color, 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 color block.

At run-time 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 colors, 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 color that was chosen in the ColorDialog.

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

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