Unit ColorBut |
bug: when you click mouse on one of these, the focus doesn't come to the button, although the click does process OK. ColorBut.PAS This is a full-featured button with color support. This was difficult to design bec. we couldn't simply inherit from TButton and override it's Paint method! We can only override protected or public methods of the base class - not private ones! Instead, we inherit from TCustomControl, and we do all of these button-related tasks ourselves: draw with bevel (3D look) draw as "pushed in" when clicked draw the caption - use specified font and alignment draw a focus box around the caption when it gets input focus allow a CR to select it if it has focus erase the focus box when it looses focus allow a Speed Key (accel. key) to activate, whether in focus or not allow it to show as disabled (grayed out caption) make sure it can't get the focus if it's disabled make sure it can't get clicked on if it's disabled allow it to respond to related Windows messages - font changed, etc allow it to have a Tpicture (like BitBtn) - also allow *.ico picture support some exotic styles (recessed 3D text, stretched pic, etc) Make sure we export "paint" as public, so a user program can easily override it.
Classes |
Functions |
GetHighlightColor -
GetShadowColor -
GetSpeedKey -
Largest -
Register - property OnDragStart; For Delphi v2 ???
First, function/procedures that aren't class members are defined
Smallest -
Types |
TAlignment
TButtonBevel
TButtonState
TButtonStyle
TButtonStyles
Constants |
Variables |
Functions |
First, function/procedures that aren't class members are defined
Types |
TAlignment = (alTopLeft, alTopCenter, alTopRight, alMiddleLeft, alMiddleCenter, alMiddleRight, alBottomLeft, alBottomCenter, alBottomRight);
TButtonBevel = (bbLowered, bbNone, bbRaised);
TButtonState = (bsUp, bsDown, bsDisabled);
TButtonStyle = set of TButtonStyles
TButtonStyles = (bsAutoSize, bsCenter, bsStretch, bsShowFocus, bsShowKey);
Constants |
Variables |