From Free Pascal wiki
Revision as of 10:58, 22 May 2020 by Wp (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


ExCtrls is a collection of controls which try to overcome limitations posed by the widgetset. Moreover, some missing controls are added.


The package is written by Werner Pamler, but re-uses a lot of code of the LCL components written by the Lazarus team.


Modified LGPL (with linking exception, like Lazarus LCL)

Download and Installation

Development version

Use an svn client to download the current trunk version from svn://svn.code.sf.net/p/lazarus-ccr/svn/components/exctrls. Alternatively download the zipped snapshot from https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/exctrls/ and unzip it to some folder.

Release version

There is no release version, yet.


In Lazarus, go to "Package" > "Open Package File .lpk". Navigate to the folder with the ExCtrls sources, and select exctrlspkg.lkp. Click "Compile", then "Use" > "Install". This will rebuild the IDE (it may take some time). When the process is finished the IDE will restart, and you'll find the components on the palettes ExCtrls and LazControls.


Sample code

The application of each component is demonstrated by a project in the folder examples coming along with the component code.

TRadioButtonEx, TCheckBoxEx, TRadioGroupEx and TCheckGroupEx

These components re-implement the standard TRadioButton, TCheckBox, TRadioGroup and TCheckGroup, but inherit from TCustomControl and thus are not drawn by the widgetset but by the ThemeServices. As a consequence there are less widgetset related restrictions although the components look and behave like their original LCL counter-parts.

New features:

  • Wordwrapped captions: If the new property WordWrap is set to true, long captions are word-wrapped to fit into the width of the control. Note that when AutoSize is active before WordWrap is activated the caption is not wrapped initially and all the text is placed into a single line. Turn AutoSize off and reduce the width of the control. Once the text is wrapped AutoSize may be switche on again to adjust the height.
  • Vertical layout: ButtonLayout and TextLayout control the vertical positioning of checkbox/radiobutton and caption, respectively. Default is tlCenter, i.e. the corresponding element is centered vertically within the bounds of the control; other values are tlTop and tlBottom. Normally ButtonLayout and TextLayout are changed in pairs.
  • User provided check images: The checkboxes and radiobuttons are normally drawn by the ThemeServices, but it is possible to provide dedicated bitmaps which can be used instead. The bitmaps must be stored in a TImageList attached to property Images. The corresponding image index must be assigned in a handler of the event OnGetImageIndex which has appropriate parameters to distinguishe between mouse-over, pressed, enabled/disabled and checked/unchecked states.
  • Custom caption colors and font settings: The font of the caption can be changed when the property ThemedCaption is switched to false. In case of TRadioGroupEx the font of individual items can only be changed at runtime by accessing the RadioGroup1.Buttons[Andex] property pointing to the TRadioButtonEx at the given index in the groupbox. The same is possible also with the TCheckGroupEx.



The default LazControls palette contains already extended spin edit controls für integers and floating point numbers (TSpinEditEx and TFloatSpinEditEx, respectively). The missing edit for currency values is implemented in package ExCtrls. Component registration put the TCurrSpinEditEx on the palette LazControls.

New and modified properties

  • Value: The data type of the control is currency.
  • CurrencyString: The currency name, for example '$' or '€', is added to the numeric value in the edit box. The default value is taken from the DefaultFormatSettings provided by the SysUtils unit.
  • CurrencyFormat: Defines the order of (positive) numeric value and currency name in the edit field:
    • secfCurrVal: currency string first, no space (e.g. '$1')
    • secfValCurr: value first, no space (e.g. '1$')
    • secfCurrSpaceVal: currency string first, space to value (e.g. '$ 1');
    • secfValSpaceCurr: value first, space to currency string (e.g. '1 $');
  • NegCurrencyFormat: Like CurrencyFormat, but now for negative values:
    • sencfParCurrValPar: currency string first, no space, the entire string is put in parenthesis (e.g. '($1)')
    • sencfMinusCurrVal: currency string first with leading '-' character, no space (e.g. '-1$')
    • sencfCurrMinusVal: currency string first, no space, '-' at value (e.g. '$-1')
    • sencfCurrValMinus: currency string first, value with appended '-' (eg. '$1-')
    • etc... Other allowed values are sencfParValCurrPar ('1$'), sencfMinusValCurr ('-1$'), sencfValMinusCurr ('1-$'), sencfValCurrMinus ('1$-'), sencfMinusValSpaceCurr ('-1 $'), sencfMinusCurrSpaceVal ('-$ 1'), sencfValSpaceCurrMinus ('1 $-'), sencfCurrSpaceValMinus ('$ 1-'), sencfCurrSpaceMinusVal ('$ -1'), sencfValMinusSpaceCurr ('1- $'), sencfParCurrSpaceValPar ('($ 1)'), sencfParValSpaceCurrPar ('(1 $)')
  • DecimalSeparator: Character used to separate decimals from the integer part. Defaults to the value defined by the DefaultFormatSettings.
  • ThousandSeparator:If not empty (i.e. not #0) the integer part of the Value is formatted with a thousand separator for better readability. Note that the control does not allow DecimalSeparator and ThousandSeparator to be equal.