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

type TColorButton = class(TCustomSpeedButton)

protected

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  procedure DoAutoAdjustLayout(); override;

  

Applies auto-layout changes using the specified policy and scaling proportions to the control.

  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 dimensions for new instances of the class.

  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 on its Parent control.

  property Anchors: TAnchors;

  

The set of anchor definitions for this control.

  property AllowAllUp: Boolean;

  

Indicates if all buttons in a group can be in an up state.

  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;

  

Contains 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 responds to mouse or keyboard input.

  property Flat: Boolean;

  

Indicates whether the button is displayed with a Flat (non-relief) appearance.

  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;

  

Indicates the alignment of the glyph bitmap relative to the caption for the control.

  property Margin: Integer;

  

Space between the glyph bitmap and the aligned edge in the button layout.

  property Spacing: Integer;

  

Spacing between the Glyph bitmap and the Caption for the control.

  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 signalled when a mouse double click occurs in the control.

  property OnMouseDown: TMouseEvent;

  

Event handler signalled when a mouse down event is handled for the control.

  property OnMouseEnter: TNotifyEvent;

  

Event handler signalled when the mouse pointer has entered the control.

  property OnMouseLeave: TNotifyEvent;

  

Event handler signalled when the mouse pointer has left the control.

  property OnMouseMove: TMouseMoveEvent;

  

Event handler signalled when the mouse pointer is moved in the control.

  property OnMouseUp: TMouseEvent;

  

Event handler signalled when a mouse up event is handled for the control.

  property OnMouseWheel: TMouseWheelEvent;

  

Event handler for mouse wheel turned.

  property OnMouseWheelDown: TMouseWheelUpDownEvent;

  

Event handler signalled for a downward movement of the mouse wheel.

  property OnMouseWheelUp: TMouseWheelUpDownEvent;

  

Event handler signalled for an 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 signalled when the Bounds for the control have been changed.

  property ShowHint: Boolean;

  

Enables Hint display for the control.

  property ParentFont: Boolean;

  

Indicates if the Font from the Parent control is used in the control.

  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 for the TSpeedButton class.

|

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,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

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.


Version 3.2 Generated 2024-02-25 Home