ExCtrls/ru

From Free Pascal wiki
Revision as of 00:49, 23 May 2020 by Zoltanleo (talk | contribs)
Jump to navigationJump to search

Template:MenuTranslate

О компоненте

ExCtrls представляет собой набор элементов управления, которые пытаются преодолеть ограничения, накладываемые набором виджетов. Более того, добавлены некоторые недостающие элементы управления.

Авторство

Пакет написан Werner Pamler (Вернером Памлером), но многократно использует большой код компонентов LCL, написанных командой Lazarus.

Лицензия

Модифицированная LGPL (с исключением ссылок, как Lazarus LCL)

Загрузка и установка

Версия для разработчиков

Используйте клиент SVN для загрузки текущей версии транка из svn://svn.code.sf.net/p/lazarus-ccr/svn/components/exctrls. Или загрузите архив снапшота с https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/exctrls/ и распакуйте в какую-нибудь папку.

Release версия

Пока релизных версий нет.

Установка

В Lazarus перейдите через меню "Package"(Пакет) > "Open Package File .lpk" (Открыть файл пакета .lpk). Перейдите в папку с исходниками ExCtrls и выберите exctrlspkg.lkp. Нажмите "Compile"(Компилировать), затем "Use"(Использовать) > "Install"(Установить). Это запустит пересборку IDE (может занять некоторое время). Когда процесс будет завершен, IDE перезапустится, и вы найдете компоненты в палитрах ExCtrls и LazControls.

Использование

Простой код

Применение каждого компонента демонстрируется проектом в папке examples вместе с кодом компонента.

TRadioButtonEx, TCheckBoxEx, TRadioGroupEx и TCheckGroupEx

Эти компоненты повторно реализуют стандартные TRadioButton, TCheckBox, TRadioGroup и TCheckGroup, но наследуются от TCustomControl и, таким образом, рисуются не набором виджетов, а ThemeServices. Как следствие, существует меньше ограничений, связанных с набором виджетов, хотя компоненты выглядят и ведут себя как их исходные аналоги LCL.

Новые функции:

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

checkcontrolsEx.png

TCurrSpinEditEx

The default LazControls palette contains already extended spin edit controls for 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.

savingscalculator.png