XCustomControl classXSplitPanels unitXControls.pas unit

    This unit contains definition of XCustomControl class and several derived from it self-painting controls. Detailed definition of XCustomControl itself is separated in previous topic, because it can be primarely interested for whose of You, who wuold like to design your own self-painting controls. In this article only definitions of descenders from XCustomControl are located. Definition of the most of such controls is located in XControls.pas. But some sets of self-painted controls have its own units. To make the observe more visible, I do not retype here all inherited methods, and leave out detailed definition of the most of properties and own methods of controls, reserving more space to discuss its ones certain for such controls.
     Let me remind here, that XCustomControl class is derived from XControl and is intended to be a base class for all self-painting controls (presented here), which are not windowed. Such controls are similar to TGraphicControl in VCL and need not window handle, using parent window (form) for showing. But those all require XCanvas to perform painting and must be painted itself. Also, its are not using standard Microsoft Foundation Classes to do what its have to do. So, code of applet, which contains such controls, can be larger, then in case of using only MFC-based controls. And creating of new self-painted control can be more complicated task, then creating of mfc-based ones.
    Therefore, self-painted controls have some additional advantages. First, its are created by us and not by Windows creators. So, we can make its more clever, using more advanced algorithms to perform some works (e.g., handling of huge data arrays). Or, we can perform painting without flickering, using rotated texts (MFC-based controls can not draw rotated texts correctly without overriding of painting), custom backgrounds and so on.
    It is also possible to combine self-painted and mfc-based controls together on one form (but this will increase applet size). To get more info about Mfc-based controls read appropriate topic of this documentation.
This topic may be not finished, I have just listed here the most important properties, methods and events.. Look to the source (XControls.pas) to get more info.
    You can find here brief definition of following self-painting controls:



XLabelXLabel

    XLabel is very similar to TLabel of VCL and it is intended to present static text labels for other controls. There is exist also MFC-control XWLabel in XCL, derived from XMfcControl, but it can not show correctly rotated text. XLabel can do it with no problems (but You have to use add-on XRotateFonts in that case).
    XLabel itself can not be transparent - it fills its background with given Color.May be, it can not do something else (e.g., word wrapping). But if all developers of combined controls will satisfy a recommendation to create labels using procedure NewLabel, it is possible, that this function (using add-on) will return not XLabel itself, but its advanced descendent, which could perform any additional task You need. This way can seem to be a little strange, but point is that this allows replace all internal labels used in combined controls as part and parcel of these last.Thus, all combined controls could be improved without of changing its source.

XLabel properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Autosize : Boolean;
  • Caption : String;
  • READ ONLY Font : XFont;
    - The most important difference of XLabel from CLabel (MFC-based) and TLabel in VCL is ability to paint correctly rotated text caption (in case of using XRotateFonts.pas add-on).
  • Alignment : XTextAlignment;
    type XTextAlignment = ( taLeft, taCenter, taRight );
XLabel methods:
  • PROTECTEDprocedure Resize; virtual;
  • PROTECTEDprocedure Initialize; override;
  • procedure PaintTo( C : XCanvas; Rect : TRect ); override;
  • function DesiredSize : TSize; override;
XLabel events:
  • OnChangeAppearance : XOnEvent;
  • OnKeyDown * : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;
   * Here and below with gray color marked events, which have no sense. E.g., OnKey... events for non-focusable controls have no sense and never called.

I recommend to use function NewLabel( AParent : XClass; Caption : String ) : XLabel instead of direct usage of XLabel constructor. This allow to replace all XLabels in applet (including those which are parts of combined controls) with more advanced XLabel descedents using possible add-ons (there are no such ones now, but in future its are possible...).


XCustomBevel

    XCustomBevel is a prototype of beveled self-painting controls, occupying a rectangle and having optional 3D-border. This class is very convenient to create new self-painting control.

XCustomBevel properties:
  • Align : XAlign;
  • PROTECTEDColor : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • PROTECTEDBevelEdges : XBevelEdges;
    type XBevelEdges = Set of ( beLeft, beTop, beRight, beBottom );
  • PROTECTEDBevelInner : XBevelStyle;
    type XBevelStyle = ( bvNone, bvRaised, bvLowered );
  • PROTECTEDBevelOuter : XBevelStyle;
  • PROTECTEDBevelWidth : Integer;
  • PROTECTEDBorderWidth : Integer;
XCustomBevel methods:
  • procedure PaintTo( C : XCanvas; Rect : TRect ); override;
XCustomBevel events:
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XBevelXBevel

    XBevel is ready-to-use control derived from XCustomBevel by making its beveling properties public. It can play role of panel without caption (we need caption on panel very rare, isn't it?).

XBevel properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • BevelEdges : XBevelEdges;
    type XBevelEdges = Set of ( beLeft, beTop, beRight, beBottom );
  • BevelInner : XBevelStyle;
  • BevelOuter : XBevelStyle;
  • BevelWidth : Integer;
  • BorderWidth : Integer;
XBevel methods:
  • procedure Initialize; override;
XBevel events:
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XPanelXPanel

    XPanel is a panel with caption to place other controls. If You do not need caption on panel, You may use XBevel.

XPanel properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Caption : String;
  • Layout : XPanelLayout;
    type XPanelLayout = ( plCenter, plTopLeft, plTop, plTopRight, plLeft, plRight,
    plBottomLeft, plBottom, plBottomRight );
  • BevelInner : XBevelStyle;
  • BevelOuter : XBevelStyle;
  • BevelWidth : Integer;
  • BorderWidth : Integer;
  • Color : XColor;
  • READ ONLY Font : XFont;
XPanel methods:
  • procedure SetCaption( Value : String ); virtual;
  • procedure AdjustMembers; override;
XPanel events:
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XSplitpanelXSplitPanel

    Definitions of XSplitPanel and XStatus classes and several other classes needed to its implementation are placed in unit XSplitPanels.pas. XSplitPanel is requiring of XAligns.pas and calls UseAligner in its constructor.
   Using of XSplitPanel allows to place controls more easy, dividing its area onto several mouse-sizeable panels vertically or horizontally. It is possible to set initial size of inner panels and its ability to be sizeable with mouse, but only in case when special add-on XSplitSizing.pas is used. Do not forget to call UseSplitSizer to allow sizing of XSplitPanel and XStatus with mouse.

XSplitPanel properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • BevelOuter : XBevelStyle;
  • BevelWidth : Integer;
  • BorderWidth : Integer;
  • Direction : XSplitDirection; (= (sdHorizontal, sdVertical ) )
  • Side : XSplitPanelSide; ( = (sdLeft, sdRight) )
    - if Side is assigned to sdRight, then inner panels are aligned to right (bottom) and placed from right (bottom) to left (top). Accordinately, when form is resizing, only last of inner panel is resizing which is placed now leftmost (topmost).
  • Count : Integer;
    - Number of inner panels. Default is 1. But I recommend to assign value to this property even if it is 1 (to provide its autosizing).
  • READ ONLY Panels[ Idx : 1..Count ] : XInnerPanel;
  • DefaultSizing : Boolean;
    - set it to False before changing the Count property to make newly created inner panels not sizeable with mouse by default.
       And next three properties also are to set some properties of newly created inner panels by default.
  • InnerBevelStyle : XBevelStyle;
  • InnerBevelWidth : Integer;
  • InnerBorder : Integer;
XSplitPanel methods:
  • function NewInnerPanel; virtual;
  • function AdjustMembers; override;
XSplitPanel events:
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;
   All that You need to provide XStatus or XSplitPanel with ability to be resizeable using mouse is to call UseSplitSizer anywhere in Your project. This will turn on add-on XSplitSizing.pas, which also calls UseStdMouse.
   For those of You, who see the first time term "add-on", please read more carefully introduction. I only remind that XCL in differ to Delphi VCL, allows to create extending modules for existing classes, which can expand capabilities of such classes without creating of parallel branch in class tree. These mudules, called "add-on's" can be used in applet optionally or not used at all, and in that last case no code is added to executable. So, in XCL You can choose if to equip your applet with some additional capabilities or to economy its size.
   And in case of this add-on XSplitSizing, You can either use it and allow to resize inner panels with mouse or not to use it and economy size of your exe-file.

XInnerPanel

    While working with XSplitPanel, it is possible to access its inner panels using property Panels[ Idx ] : XInnerPanel.

CAUTION! Inner panels are enumerated starting from 1 not from 0.

Inner panels are read only, but it is useful to know its ascendency and main properties. Inner panels are derived from XPanel (and have Caption property as well as its ancestor) and have additional properties:


XStatusXStatus

    XStatus is very similar to TStatusBar in VCL. But it is more power, because it is derived from XSplitPanel and allows to resize its inner panels with mouse (if add-on XSplitSizing.pas is used).

XStatus properties are the same as XSplitPanel ones. The single difference is that XStatus is created bottom-aligned with certain (not too large) heihgt.

TASKS

Creating statusbar using XStatus is very easy task:

 

var SB : XStatus;

...

SB := XStatus.Create( Applet.MainForm );
SB.Count := 3;
SB.Panels[ 1 ].Caption := 'Status1';
SB.Panels[ 2 ].Caption := 'Status2';
SB.Panels[ 3 ].Caption := 'Status3';

...


XGrepXGrep

XGrep is a triangle grep placed usually to bottom-right control on form and allowing to resize it with mouse more easy. In XCL You decide where and how to place grep. Usually the best place is right inner panel of XStatus.

var St : XStatus;
   ...
with St do
   XGrep.Create( Panels[ Count ] );

If right-bottom control is XScrollBox descendant, grep has to be plased to horizontal scrollbar (when vertical scrollbar also is visible):

var SB : XScrollBox;
   ...
with SB do
   XGrep.Create( HScroll );

There are no properties or methods what are need to be known to use XGrep features.


XGroupXGroup

    XGroup is usually used to place radio boxes or other controls to visually concatenate its. But in XCL radio buttons are not in need to special grouping control and any panel, bevel or group control can be used to create such radiogroup. Appearance of XGroup is very similar to TGroupBox in VCL. Moreover, if You are using add-on XRotateFonts, it is possible to place group caption on any side of bevel rotated on 90 or 270 degrees.

XGroup properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Caption : String;
  • Layout : XGroupLayout;
    type XGroupLayout = ( glTopLeft, glTopCenter, glTopRight,
    glBottomLeft, glBottomCenter, glBottomRight,
    glLeftBottom, glLeftCenter, glLeftTop,
    glRightTop, glRightCenter, glRightBottom );
  • Bevel : XBevelStyle; ( bvNone, bvRaised, bvLowered );
  • READ ONLY Font : XFont;
XGroup methods:
  • function ClientRect : TRect; override;
  • PROTECTEDprocedure AdjustMembers; override;
  • PROTECTEDprocedure PaintChildren( DC : HDC; Rect : TRect ); override;
XGroup events:
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XPaint

Similar TPaintBox in VCL. It has event OnPaint. Set your handler to this event to perform painting. If event is not set, XPaint control just clears its background.

XPaint properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
XPaint events:
  • OnPaint : XOnPaint;
    type XOnPaint = procedure( Sender : TObject; Canvas : XCanvas; Rect : TRect ) of object;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XCustomCheckBox

    XCustomCheckBox is intended to be a base class for XCheckBox and XRadioBox. But these two last classes are differ from TCheckBox and TRadioBox in VCL. Its have no caption, and present only boxes (square for XCheckBox and rhombic for XRadioBox). If You need checkbox and radiobox with caption, use XCheck and XRadio.
    XCustomCheckBox itself does not provide painting, leaving this task for its descendents. It defines only behaviour of checkbox.

XCustomCheckBox properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Checked : Boolean;
  • BoxColor : XColor;
  • CheckColor : XColor;
  • GrayDisabled : Boolean;
  • PROTECTEDGroup : XControl;
XCustomCheckBox methods:
  • PROTECTEDprocedure SetGroup( Value : XControl );
  • PROTECTEDprocedure SetChecked( Value : Boolean ); virtual;
  • PROTECTEDfunction RadioAlternate( UnCheck : Boolean ) : Boolean;
  • procedure Click; virtual;

XCustomCheckBox events:

  • OnChanged : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XCheckboxXCheckBox

    XCheckBox is similar to TCheckBox in VCL, but without caption. If You need checkbox with caption, use XCheck.

XCheckBox properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Checked : Boolean;
  • BoxColor : XColor;
  • CheckColor : XColor;
  • GrayDisabled : Boolean;
XCheckBox methods:
  • procedure PaintTo( C : XCanvas; Rect : TRect ); override;

XCheckBox events:

  • OnChanged : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XRadioboxXRadioBox

    XRadioBox is similar to TRadioBox in VCL, but without caption. If You need in Radiobox with caption, use XRadio. Another difference is that XRadioBox controls need not special grouping control to group alternative radio boxes. By default, Parent is used as such grouping control, and it is also possible to set any other control with the same parent form as a group owner for radiobox.

XRadioBox properties
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Checked : Boolean;
  • BoxColor : XColor;
  • CheckColor : XColor;
  • GrayDisabled : Boolean;
  • Group : XControl;
XRadioBox methods:
  • procedure PaintTo( C : XCanvas; Rect : TRect ); override;

XRadioBox events:

  • OnChanged : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XCustomCheck

    XCustomCheck is derived from XCustomCheckBox and intended to be a base class for both XCheck and XRadio, which are similar to TCheckBox and TRadioBox in VCL and have caption. Moreover, XCheck and XRadio, using Layout property allow to arrange caption from left, right, top and bottom side of the box.

XCustomCheck properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Checked : Boolean;
  • BoxColor : XColor;
  • CheckColor : XColor;
  • GrayDisabled : Boolean;
  • Autosize : Boolean;
  • Caption : String;
  • Layout : XBoxLayout;
    type XBoxLayout = ( blRight, blLeft, blBottom, blTop );
  • READ ONLY Font : XFont;
XCustomCheck methods:
  • procedure AdjustMembers; override;

XCustomCheck events:

  • OnChanged : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XCheckXCheck

XCheck is very similar to TCheckBox in Delphi VCL. Using its proprty Layout, it is possible to set its caption in four directions from the box.

XCheck properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Checked : Boolean;
  • BoxColor : XColor;
  • CheckColor : XColor;
  • GrayDisabled : Boolean;
  • Autosize : Boolean;
  • Caption : String;
  • Layout : XBoxLayout;
    type XBoxLayout = ( blRight, blLeft, blBottom, blTop );
  • READ ONLY Font : XFont;
XCheck events:
  • OnChanged : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XRadioXRadio

XRadio is very similar to TRadioBox in Delphi VCL. Using its proprty Layout, it is possible to set its caption in four directions from the box. Its property Group allows to group radioboxes as You wish. By default, this property is set to Parent of the control.

XRadio properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Checked : Boolean;
  • BoxColor : XColor;
  • CheckColor : XColor;
  • GrayDisabled : Boolean;
  • Autosize : Boolean;
  • Caption : String;
  • Layout : XBoxLayout;
    type XBoxLayout = ( blRight, blLeft, blBottom, blTop );
  • READ ONLY Font : XFont;
  • Group : XClass;
XRadio events:
  • OnChanged : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XCustomButton

    XCustomButton is a button prototype. It is possible to use it without deriving new class, but it has no caption. If You need caption on a button, use XButton instead. I made a try to concentrate all possible button behaviour models here (flat, fixed, focused vs speed-button, etc.) Therefore, to get some special effects You, may be, want to derive your own button. So, XCustomButton is the best pretender to become ancestor of your one.

XCustomButton properies:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Flat : Boolean;
  • Down : Boolean;
  • Fixed : Boolean;
  • SpeedButton : Boolean;
  • Repeats : Boolean;
XCustomButton methods:
  • function FocusRect : TRect; override;

XCustomButton event:

  • OnClick : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XButton

   XButton is intended to be sufficiently universal button. It can be fixed, repeated, focused vs speed-button. Even You may set it to Flat. But this last does not mean, that it becomes "flat" in sense of standard buttons automatically. Flat just means that border is never painting (this can be useful to create glyph-buttons).

XButton properies:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Flat : Boolean;
  • Down : Boolean;
  • Fixed : Boolean;
  • SpeedButton : Boolean;
  • Repeats : Boolean;
  • Caption : String;
  • Autosize : Boolean;
XButton methods:
  • procedure AdjustMembers; override;

XButton event:

  • OnClick : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XDropButton

   XDropButton is intended to represent button with triangle drop arrow and used first time in XScroller.

XDropButton properies:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Flat : Boolean;
  • Down : Boolean;
  • Fixed : Boolean;
  • SpeedButton : Boolean;
  • Repeats : Boolean;
  • Autosize : Boolean;
  • SizeDrop : Integer;
XDropButton methods:
  • procedure PaintTo( C : XCanvas; Rect : TRect ); override;

XDropButton events:

  • OnClick : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XScrollerXScroller

   XScroller is very similar to TScrollbar in Delphi VCL. It is useful as part of XScrollBox, representing scrolling tools.

XScroller properies:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Direction : XScrollDirection; (= (sdHorizontal, sdVertical ) )
  • ScrollColor : XColor;
  • Position : Integer;
  • MaxPosition : Integer;
  • ThumbSize : Integer;
  • READ ONLY Scrolling : Boolean;
  • SmallDelta : Integer;
  • LargeDelta : Integer;
  • PageScroll : Boolean;
  • DropScrollInterval1 : Integer;
  • DropScrollInterval2 : Integer;
  • PageScrollInterval1 : Integer;
  • PageScrollInterval2 : Integer;
XScroller methods:
  • procedure AdjustMembers; override;
  • procedure DoScrollCmd( Cmd : XScrollCmd ); virtual;

XScroller events:

  • OnScroll : XOnScroll; (= procedure( Sender : TObject; ScrollCmd : XScrollCmd ) of object;
    type XScrollCmd = ( scBegin, scEnd, scLineBck, scLineFwd, scPageBck, scPageFwd );
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XScrollBar

   XScrollBar adds to XScroller ability to recognize existance of once more scrollbar among sibling controls and to provide its interdependence (appearing of empty square at the right side of horizontal scrollbar when both scrollbars are visible). Additionally, XScrollBar is auto-aligning to right and bottom (in depend on Direction property). So, XScrollBar is very useful when both scrollbars are used together.

XScrollBar properies:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Direction : XScrollDirection; (= (sdHorizontal, sdVertical ) )
  • ScrollColor : XColor;
  • Position : Integer;
  • MaxPosition : Integer;
  • ThumbSize : Integer;
  • READ ONLY Scrolling : Boolean;
  • SmallDelta : Integer;
  • LargeDelta : Integer;
  • PageScroll : Boolean;
  • DropScrollInterval1 : Integer;
  • DropScrollInterval2 : Integer;
  • PageScrollInterval1 : Integer;
  • PageScrollInterval2 : Integer;
XScrollbar methods:
  • procedure AdjustMembers; override;

XScrollbar events:

  • OnScroll : XOnScroll; (= procedure( Sender : TObject; ScrollCmd : XScrollCmd ) of object;
    type XScrollCmd = ( scBegin, scEnd, scLineBck, scLineFwd, scPageBck, scPageFwd );
  • OnChangeVisibility : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XScrollboxXScrollBox

   XScrollBox is very similar to TScrollBox in Delphi VCL. It uses XScrollBar controls and allows to scroll its content with mouse. If XScrollBox is used with autosizing of forms and controls, it can be sensible to turn autosizing of form off before filling XScrollBox with internal controls.
   It is the XScrollBox first, which uses FScrollOffset : TSize reserved field. This field was reserved as protected in XVisual and it is using in calculating of ControlRect to take in consideration possible scrolling. But first it is changing in XScrollBox, and this last also overrides :

  1. painting of its children to provide accurate painting of scrolled ones and
  2. searching of children at given position to pass them correctly mouse events.
XScrollBox properies:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • HScrollVisibility : XScrollVisibility; (= (svAuto, svNone, svAlways ) )
  • VScrollVisibility : XScrollVisibility;
  • READ ONLY HScroll : XScrollBar;
  • READ ONLY VScroll : XScrollBar;
XScrollBox methods:
  • function ControlAtPos( X, Y : Integer; IgnoreDisabled : Boolean ) : XControl; override;
  • procedure DoPaint( DC : HDC; Rect : TRect ); override;
  • procedure PaintTo( C : XCanvas; Rect : TRect ); override;

XScrollBox events:

  • OnScroll : XOnEvent;
  • OnKeyDown : XOnKey;
  • OnKeyUp : XOnKey;
  • OnKeyPress : XOnKeyPress;
  • OnMouseDown : XOnMouseUpDown;
  • OnMouseUp : XOnMouseUpDown;
  • OnMouseMove : XOnMouse;

XNotebook

   XNotebook is defined in XControls.pas. It is very similar to TNotebook in VCL and allows to place different sets of controls on several pages, only one of each is visible at a time. XNotebook does not suggest any additional visible elements to change pages by user. To have such control tools, use XTabbedNotebook. XNotebooks without tabs can be used to provide showing of pages in certain sequence using its properties and methods at run time.

XNotebook properties
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • BevelEdges : XBevelEdges
  • BevelInner : XBevelStyle;
  • BevelOuter : XBevelStyle;
  • BevelWidth : Integer;
  • BorderWidth : Integer;
  • ActivePage : XNotebookPage;
  • ActuveIndex : Integer;
  • Count : Integer;
  • Pages[ Idx : 0..Count-1 ] : XNotebookPage;
XNotebook events
  • OnChangePage : XOnEvent;

XNotebook uses XNotebookPage objects as its inner pages. XNotebookPage is derived from XCustomBevel and overrides constructor and destructor to give know to its parent XNotebook about itself. There are no other methods and properties made public in XNotebookPage.
   The main purpose of this one is to be parent of controls on page. To place controls on it, simply pass page of XNotebook as a parameter of constructor for newly created control:

var NB : XNotebook;
    B1 : XButton;
...
   B1 := XButton.Create( NB.Pages[ 0 ] );
...


XTabsXTabs

   XTabs control is intended to be a body part of XTabbedNotebook, allowing to switch between notebook pages using mouse or keyboard and to show title of active page. It can be used separately, e.g. to implement bookmarks and so on.
   XTabs control can be focused. In that case user can use Ctrl+Tab key combination (if XKeyboardEvents add-on is in use) to switch between tabs. And, in that case, current tab is drawing with dotted focus rectangle (if add-on XFocusDrawing is used). Also, if add-on XMouseEvents is in use, user can switch between tabs using mouse.

XTabs properties:
  • Align : XAlign;
  • Color : XColor;
  • BoundsRect : TRect;
  • Left : Integer;
  • Top : Integer;
  • Width : Integer;
  • Height : Integer;
  • Enabled : Boolean;
  • Tag : Pointer;
  • Layout : XTabsLayout (= tlTop, tlBottom, tlLeft, tlRight );
  • Count : Integer;
  • Tabs[ 0..Count-1 ] of XTab;
  • ActiveIndex : Integer;
    - index of tab under mouse cursor or of tab, which was last activated using mouse.
  • CurrentIndex : Integer;
  • TabSize : Integer;
  • MinTabShow : Integer;
  • Font : XFont;
XTabs methods:
  • function ControlAtPos( X, Y : IgnoreDisabled : Boolean ) : XControl; override;

XTabs events:

  • OnChangeActive : XOnEvent;
  • OnChangeCurrent : XOnEvent;

XTabs uses XTab (derived from XPanel) to use it as tab member. You only have to know, that it is a Panel, and can have Caption, visible at the tab. Set captions of given tab bookmarks to desired value at run time, e.g.:

   MyTabs.Tabs[ 0 ] := 'TabSheet1';
   MyTabs.Tabs[ 1 ] := 'TabSheet2';
   ...


XTabbedNotebookXTabbedNotebook

   XTabbedNotebook is a simple combination of XNotebook and XTabs which are working together. Use it, if You do not care about sequence in access to different pages of notebook.

to be continued...


goto XCL page

goto home page