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 descendents from XCustomControl are located. To make the observe more visible, I do not retype here detailed definition of all inherited properties and methods, leaving 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, which are not windowed. Such controls are similar to TGraphicControl in VCL and do not need in 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 text (MFC-based controls can not draw rotated text correctly), 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. Look to the source (XControls.pas) to get more info.
    You can find here definition for following self-painting controls:


XLabel

    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:

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:


XBevel

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

XBevel properties:


XPanel

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

XPanel properties:


XGrep

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.

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):

with SB do
   XGrep.Create( HScroll );

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


XGroup

    XGroup is usually used to place radio boxes or other controls to visually concatenate its. But in XCL radio buttons do not need in 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:


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 clear its background.

XPaint properties:

XPaint events:


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:

XCustomCheckBox methods:

XCustomCheckBox events:


XCheckBox

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

XCheckBox properties:

XCheckBox events:


XRadioBox

    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

XRadioBox events:


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 box.

XCustomCheck properties:

XCustomCheck events:


XCheck

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:

XCheck events:


XRadio

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:

XRadio events:


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 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:

XCustomButton event:


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:

XButton event:


XDropButton

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

XDropButton properies:

XDropButton event:


XScroller

   XScroller is very similar to TScrollbar in Delphi VCL. It is useful as part of XScrollBar, representing scrollable controls.

XScroller properies:

XScroller events:


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:

XScrollbar events:


XScrollBox

   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.

XScrollBox properies:

XScrollBar events:


goto XCL page

goto home page