Sign in Join
FPDoc Onlineexperiment

TColorButton class

In unit Dialogs

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

Declaration

pascal
TColorButton = class(TCustomSpeedButton)

Inheritance

  1. TColorButton
  2. TCustomSpeedButton
  3. TGraphicControl
  4. TControl
  5. TLCLComponent
  6. TComponent

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.

Properties

ActionpublishedThe Action associated with the control.
AlignpublishedSpecifies the placement of the control on its Parent control.
AnchorspublishedThe set of anchor definitions for this control.
AllowAllUppublishedIndicates if all buttons in a group can be in an up state.
BorderSpacingpublishedDetermines the inner and outer border spacing for this control.
BorderWidthpublishedWidth for the borders on the button control.
ButtonColorAutoSizepublishedTrue if the color block for the button can be automatically resized to fill the unused client area.
ButtonColorSizepublishedSize of the color block (or swatch) on the button control.
ButtonColorpublishedThe TColor value selected in the button control.
ColorDialogpublishedThe color selection dialog displayed when the control is clicked, or the ShowColorDialog method is called.
ConstraintspublishedContains the minimum and maximum Width and Height for the control.
CaptionpublishedText displayed next to the color block on the button control.
ColorpublishedThe Color of the control itself, i.e. the parts that are not the color display block; edges, background etc.
DownpublishedIndicates if the button has been set to the Down state.
EnabledpublishedDetermines whether the control responds to mouse or keyboard input.
FlatpublishedIndicates whether the button is displayed with a Flat (non-relief) appearance.
FontpublishedThe font to be used for text display in this control.
GroupIndexpublishedIdentifies the group to which the speed button control belongs.
HintpublishedThe text to show in the Hint window for the control.
LayoutpublishedIndicates the alignment of the glyph bitmap relative to the caption for the control.
MarginpublishedSpace between the glyph bitmap and the aligned edge in the button layout.
SpacingpublishedSpacing between the Glyph bitmap and the Caption for the control.
TransparentpublishedIndicates if the control is drawn with transparency.
VisiblepublishedAllows the control, and all of its children, to be displayed or hidden.
ShowHintpublishedEnables Hint display for the control.
ParentFontpublishedIndicates if the Font from the Parent control is used in the control.
ParentShowHintpublishedIf True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
PopupMenupublishedA context-sensitive menu that pops up when the right mouse button is clicked over this control.

Methods

WSRegisterClassprotectedRegisters this component class with the current WidgetSet.
DoAutoAdjustLayoutprotectedApplies auto-layout changes using the specified policy and scaling proportions to the control.
DrawGlyphprotectedRe-implements drawing the glyph for the control to use the selected color.
GetDisabledPatternprotectedGets a bitmap with the disabled pattern for the control.
GetGlyphSizeprotectedGets the size for the glyph (color block / swatch) on the button control.
GetControlClassDefaultSizeprotectedReturns the default dimensions for new instances of the class.
NotificationprotectedPerforms actions when the specified component is added to or removed from the control.
ShowColorDialogprotectedDisplays a Color dialog and captures its result.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
ClickpublicPerforms actions needed when the control is clicked.

Events

OnClickpublishedNotification handler for mouse clicks.
OnColorChangedpublishedEvent handler signalled when the button color has been changed.
OnDblClickpublishedEvent handler signalled when a mouse double click occurs in the control.
OnMouseDownpublishedEvent handler signalled when a mouse down event is handled for the control.
OnMouseEnterpublishedEvent handler signalled when the mouse pointer has entered the control.
OnMouseLeavepublishedEvent handler signalled when the mouse pointer has left the control.
OnMouseMovepublishedEvent handler signalled when the mouse pointer is moved in the control.
OnMouseUppublishedEvent handler signalled when a mouse up event is handled for the control.
OnMouseWheelpublishedEvent handler for mouse wheel turned.
OnMouseWheelDownpublishedEvent handler signalled for a downward movement of the mouse wheel.
OnMouseWheelUppublishedEvent handler signalled for an upward movement of the mouse wheel.
OnPaintpublishedEvent handler signalled to paint the control.
OnResizepublishedNotification handler for a resize of the control.
OnChangeBoundspublishedEvent handler signalled when the Bounds for the control have been changed.

Inherited

From TCustomSpeedButton (44)

ActionChange Alignment ButtonGlyph CalculatePreferredSize DialogChar DisabledImageIndex DrawEffectsEnabled FindDownButton GetActionLinkClass GetDrawDetails GetNumGlyphs GetTextSize Glyph GlyphChanged GlyphImageLayout HotImageIndex ImageIndex Images ImageWidth Loaded LoadGlyphFromLazarusResource LoadGlyphFromResourceName MeasureDraw MouseDown MouseEnter MouseInControl MouseLeave MouseMove MouseUp NumGlyphs Paint PaintBackground PressedImageIndex RealSetText SelectedImageIndex SetDown SetFlat SetGroupIndex SetMargin SetNumGlyphs SetSpacing ShowAccelChar ShowCaption UpdateState

From TGraphicControl (5)

Canvas CMCursorChanged DoOnChangeBounds DoOnParentHandleDestruction FontChanged

From TControl (369)

AccessibleDescription AccessibleName AccessibleRole AccessibleValue ActionLink ActiveDefaultControlChanged AddHandler AddHandlerOnBeforeDestruction AddHandlerOnChangeBounds AddHandlerOnEnabledChanged AddHandlerOnEnabledChanging AddHandlerOnKeyDown AddHandlerOnMouseWheel AddHandlerOnResize AddHandlerOnVisibleChanged AddHandlerOnVisibleChanging AdjustSize AnchorAsAlign AnchorClient AnchoredControlCount AnchoredControls AnchorHorizontalCenterTo AnchorParallel AnchorSame AnchorSide AnchorSideBottom AnchorSideChanged AnchorSideLeft AnchorSideRight AnchorSideTop AnchorToCompanion AnchorToNeighbour AnchorVerticalCenterTo AssignTo AutoAdjustLayout AutoSize AutoSizeDelayed AutoSizeDelayedHandle AutoSizeDelayedReport AutoSizePhases AutoSizing AutoSizingAll AutoSizingLockCount BaseBounds BaseParentClientSize BeforeDestruction BeforeDragStart BeginAutoDrag BeginAutoSizing BeginDrag BiDiMode BoundsChanged BoundsRect BoundsRectForNewParent BringToFront CalculateDockSizes CanAutoSize CanTab CaptureChanged CaptureMouseButtons ChangeBounds Changed ChangeScale CheckChildClassAllowed CheckNewParent CheckOnChangeBounds ChildClassAllowed ClientHeight ClientOrigin ClientRect ClientToParent ClientToScreen ClientWidth CMBiDiModeChanged CMChanged CMEnabledChanged CMHintShow CMHitTest CMMouseEnter CMMouseLeave CMParentBiDiModeChanged CMParentColorChanged CMParentFontChanged CMParentShowHintChanged CMSysFontChanged CMTextChanged CMVisibleChanged CNPreferredSizeChanged ColorIsStored ConstrainedResize ControlFontClass ControlOrigin ControlState ControlStyle ControlToScreen CreateAccessibleObject CreateControlBorderSpacing CreateFloatingDockSite Cursor DblClick DefineProperties DesktopFont DisableAutoSizing DoAllAutoSize DoAutoSize DoBorderSpacingChange DoCallKeyEventHandler DoCallMouseWheelEventHandler DoCallNotifyHandler Dock Docked DockOrientation DockTrackNoTarget DoConstraintsChange DoContextPopup DoDock DoDragMsg DoEndDock DoEndDrag DoFixDesignFontPPI DoFloatMsg DoMouseDown DoMouseUp DoMouseWheel DoMouseWheelDown DoMouseWheelHorz DoMouseWheelLeft DoMouseWheelRight DoMouseWheelUp DoOnResize DoOnShowHint DoScaleFontPPI DoSetBounds DoStartDock DoStartDrag DragCanceled DragCursor DragDrop Dragging DragKind DragMode DragOver EditingDone EnableAutoSizing EnabledChanged EnabledChanging EndAutoSizing EndDrag ExecuteCancelAction ExecuteDefaultAction FindSubComponent FixDesignFontsPPI Floating FloatingDockSiteClass ForeignAnchorSideChanged FormEndUpdated FormIsUpdating GetAccessibleObject GetAction GetAnchorsDependingOnParent GetCachedText GetCanvasScaleFactor GetChildAccessibleObjectAtPos GetChildrenRect GetClientOrigin GetClientRect GetClientScrollOffset GetColorResolvingParent GetControlOrigin GetCursor GetDefaultColor GetDefaultDockCaption GetDefaultHeight GetDefaultWidth GetDeviceContext GetDockEdge GetDragImages GetEnabled GetFloating GetFloatingDockSiteClass GetLogicalClientRect GetMouseCapture GetMousePosFromMessage GetPalette GetParentBackground GetParentComponent GetPopupMenu GetPreferredSize GetRGBColorResolvingParent GetScrolledClientRect GetSelectedChildAccessibleObject GetSidePosition GetTextBuf GetTextLen GetTopParent HandleObjectShouldBeVisible HasHelp HasParent Height HeightIsAnchored HelpContext HelpKeyword HelpType Hide HostDockSite InitiateAction Invalidate InvalidateControl InvalidatePreferredSize IsAParentAligning IsBorderSpacingInnerBorderStored IsCaptionStored IsClientHeightStored IsClientWidthStored IsControl IsControlVisible IsEnabled IsParentColor IsParentFont IsParentOf IsProcessingPaintMsg IsRightToLeft IsVisible Left LMCaptureChanged LoadedAll LRDockWidth ManualDock ManualFloat MouseCapture MouseInClient OnConstrainedResize OnContextPopup OnDragDrop OnDragOver OnEditingDone OnEndDock OnEndDrag OnMouseWheelHorz OnMouseWheelLeft OnMouseWheelRight OnQuadClick OnShowHint OnStartDock OnStartDrag OnTripleClick Parent ParentBackground ParentBiDiMode ParentColor ParentDestroyingHandle ParentFontChanged ParentFormHandleInitialized ParentHandlesAllocated ParentToClient Perform PositionDockRect QuadClick ReadBounds ReadState RealGetText Refresh RemoveAllHandlersOfObject RemoveHandler RemoveHandlerOnBeforeDestruction RemoveHandlerOnChangeBounds RemoveHandlerOnEnabledChanged RemoveHandlerOnEnabledChanging RemoveHandlerOnKeyDown RemoveHandlerOnMouseWheel RemoveHandlerOnResize RemoveHandlerOnVisibleChanged RemoveHandlerOnVisibleChanging Repaint ReplaceDockedControl RequestAlign Resize Scale96ToFont Scale96ToForm Scale96ToScreen ScaleConstraints ScaleDesignToForm ScaleFontsPPI ScaleFontTo96 ScaleFontToScreen ScaleFormTo96 ScaleFormToDesign ScaleScreenTo96 ScaleScreenToFont ScreenToClient ScreenToControl SendMoveSizeMessages SendToBack SessionProperties SetAction SetAlign SetAnchors SetAutoSize SetBiDiMode SetBounds SetBoundsKeepBase SetColor SetCursor SetDragMode SetEnabled SetHint SetInitialBounds SetName SetParent SetParentBackground SetParentBiDiMode SetParentComponent SetTempCursor SetTextBuf SetVisible SetZOrder ShouldAutoAdjust Show ShowHelp TBDockHeight Text TextChanged Top TripleClick UndockHeight UndockWidth Update UpdateAnchorRules UpdateBaseBounds UpdateMouseCursor UpdateRolesForForm UseRightToLeftAlignment UseRightToLeftReading UseRightToLeftScrollBar VisibleChanged VisibleChanging Width WidthIsAnchored WindowProc WMCancelMode WMContextMenu WMLButtonDBLCLK WMLButtonDown WMLButtonQuadCLK WMLButtonTripleCLK WMLButtonUp WMMButtonDBLCLK WMMButtonDown WMMButtonQuadCLK WMMButtonTripleCLK WMMButtonUp WMMouseHWheel WMMouseMove WMMouseWheel WMMove WMRButtonDBLCLK WMRButtonDown WMRButtonQuadCLK WMRButtonTripleCLK WMRButtonUp WMSize WMWindowPosChanged WMXButtonDBLCLK WMXButtonDown WMXButtonQuadCLK WMXButtonTripleCLK WMXButtonUp WndProc WriteLayoutDebugReport

From TLCLComponent (6)

DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.