Lazarus 4.0 release notes

From Free Pascal wiki
Jump to navigationJump to search

Lazarus 4.0 is not yet released. This page is under construction!

LCL Interfaces Changes

LCL Changes


Support for Queries

  • Because the unit LCLTaskDialog has been deprecated, the query capabilities of LCLTaskDialog.TTaskDialog have been added to Dialogs.TTaskDialog, albeit with a slightly different implementation.
    • New flag tfQuery: adds a query (in the form of a combobox) to the dialog.
      • New property QueryChoices (TStrings): sets the predefined answers.
      • New property QueryItemIndex: sets the ItemIndex of the combobox and holds said ItemIndex when the dialog is closed.
      • New flag tfQueryFixedChoices: control whether or not the user can add his/hers own text to the combobox.
      • New property QueryResult: holds the text of the choice made when the dialog closes.
    • New flag tfSimpleQuery: adds a single line Edit to the dialog. Note: this flag is mutually exclusive with the tfQuery flag.
      • New property SimpleQuery: sets the initial text of the Edit.
      • New property SimpleQueryPassWordChar: sets PassWordChar of the single line query editor.
      • Property QueryResult holds the text of the Edit when the dialog closes.

New events

The following (most of them Delphi compatible) events were implemented:

  • OnDialogConstructed
  • OnDialogCreated
  • OnDialogDestroyed
  • OnVerificationClicked. This also updates the Flags property to reflect the current state of the verification checkbox.
  • OnExpanded. The associated new property Expanded only has meaning in the context of this event.
  • OnTimer
  • OnRadioButtonClicked
  • OnHyperlinkClicked (Windows Vista+ native dialog only). The associated new property URL only has meaning in the context of this event.
  • OnNavigated (Windows Vista+ native dialog only). This event only fires if the dialog has pages (see: MS docs). Pages are not implemented in TTaskDialog, but they might be implemented in a derived class. The event handler must however be in the base class for Delphi compatibility.
  • OnHelp. Does not exist in Delphi (even though Delphi does have a protected method DoOnHelp). Triggers when user presses F1 when the dialog is open.

New properties

  • CollapseButtonCaption: controls the caption of the Expand/Collapse button when the dialog is in expanded state.
  • CustomMainIcon and CustomFooterIcon: icons to be displayed in the dialog (instead of the standard icons) when the flags tfUseHIconMain and tfUseHIconFooter are used.
  • ProgressBar: the progressbar on the dialog. You can set it's properties Position, Min, Max, MarqueeSpeed (native Vista+ only) and State (native Vista+ only). When the dialog is shown, you can send messages (e.g. in OnDialogXXX events) to alter these properties.

Support for messages

  • Support for sending messages (via SendMessage) to the dialog has been added to the emulated dialog. This allows a.o. to enable/disable (radio)buttons, click (radio)buttons and update captions (Title, Text, FooterText and ExpandedText)


  • Added FirstDayOfWeek as a new publishced property since it has been present in TCalendar but could not be accessed easily.


  • New public method function PtInShape(const P: TPoint): Boolean to determine whether the specified point P lies within the shape boundaries.
  • New event OnShapeClick firing when a click on the control occurs within the shape boundaries
  • The control can be selected in the form designer only by clicking somewhere within the shape. Clicking on controls covered by the TShape can still be selected when the click is outside the shape boundary.
  • New event OnShapePoints, together with the new TShapeType element tsPolygon, gives the user the opportunity to define an arbitrary polygon for the component.


  • The published EditLabel.Layout property could not be changed due to anchoring. The anchor was removed, and EditLabel.Layout now can be adjusted when the label is at the left or right side of the edit.
  • New property EditLabel.Alignment to adjust horizontal position of the label when it is above or below the edit.


  • New properties TimeFormat and TimeSeparator for more flexible formatting of the time output.


  • Old behaviour: InitialDir was unchanged after user executed the dialog.
  • New behaviour: if the dialog is executed, InitialDir is set to the directory of the dialog (even if the dialog is cancelled).
  • Reason: consistency with the behaviour of TOpenDialog.
  • Commit: 4c4c9631


  • Added crsSameSize for sizing all columns/row to have each an equal share of the available space.

IDE Changes

Compiler Options

  • Added project compiler option for SubTarget.
  • Added IDE macro $(FPCTarget), a short form of $(TargetCPU)-$(TargetOS)-$(SubTarget).
  • Added compiler option Write config instead of command line parameters (@). See here. Useful for passing large amount of paths to the compiler or an easier way to use the Lazarus options in your build scripts.
  • Added predefined variable Laz_FullVersion to conditionals. See here. Useful to define Lazarus version dependent command line parameters.
  • Wildcards * and ** in search paths. See here.


  • Added elastic tabs
  • Pas-Highlighter: added color for Proc/Var modifiers
  • Gutter
    • Configurable padding between parts for improved readability
    • Configurable Width (e.g. space for more marks breakpoint, bookmark and error/warning)
    • Highlight of current line in gutter
    • Highlight of inner-most fold section in fold-tree gutter
  • Syncro-Edit
    • Added key-combos for matching words case-sensitive or insensitive. Added key-combos for matching words according to their "context" (e.g. don't group code with strings or comments)
    • Added ability to add custom cells from selection
    • Added ability to resize cells


  • Alt + Left-Mouse Gutter click / Ctrl-Alt-F5: Add breakpoint (if not yet set) and ,pen properties of breakpoint.
  • Color config for assembler window
  • Breakpoint window can group breakpoints by "group". Change group by drag and drop
  • Run Param (Windows only): Allow to specify the default pos/size for console/gui window.
  • Run Param: Redirect StdIn/Out/Err (FpDebug and "Run without debug" on Linux/Windows)
  • "Debug visualizers" / Value-Formatter
  • New "DisplayFormats" for watches
    • Values in arrays and structures are now following the DisplayFormat
    • Global (and Project) Defaults for Watch-DisplayFormats. (Including global settings for Hints, and Locals)

Sample EditMask files in property editor for TMaskEdit.EditMask

  • If you load a sample EditMask file in the property editor, the IDE now reloads this file when you invoke the property editor again
  • You can unload a sample file if you don't want to have it loaded anymore.
  • The property editor supports Delphi sample files (*.dem) as well as Lazarus sample files (*.lem), the latter having a more relaxed syntax.
  • Lines in a sample file which do not properly represent a sample editmask are ignored.
  • For the time being, Lazarus does not distribute sample editmask files, mostly because of possible copyright issues.

Code Templates

These are the templates you get by a shortcut Ctrl+J in the editor.

  • File containing default templates lazarus_dci_file.dci was renamed to codetemplates.dci. This is an internal lazarus file and does not affect custom templates, which are still located in the configuration folder.
  • The class TSynAutoComplete (actually TCustomSynAutoComplete) interface was changed to support ordering the list of templates properly. This class is probably used only for the Ctrl+J templates and not for any user code. If it is used somewhere, then the code must be adjusted.

IDE Interface Changes



  • TBubbleSeries: New BubbleSizeUnits options bruPercentageRadius and bruPercentageArea - the bubble size values are interpreted as bubble radius or bubble area. The bubble radius then is drawn as a percentage of the plot area size where the largest bubble corresponds to BubbleRadiusPercentage.
  • TChartSeries: New event OnGetMarkText, similar to OnGetMark, but with additional parameters (series, y index and x index of the data point) for specifying individual data point labels in multi-values series. OnGetMark has been deprecated and will be removed when v5.0 is released
  • TLineSeries: New LineTypes ltStepCenterXY and ltStepCenterYX, available in LibreOffice Calc.
  • TPieSeries, TBubbleSeries, TBarSeries allow controlling all brush and pen parameters of individual data points by means of the Styles property.
  • Chart sources can provide multi-level data-point labels separated by the LabelSeparator.
  • Chart.AxisPosition now can be given in axis units (cuAxis). For performing the correct axis transformation, the index of the orthogonal axis containing the Position value must be specified, OrthogonalAxisIndex.
  • Chart styles were extended to support individual series pointers per y level.

Changes affecting compatibility

LCL incompatibility


  • The implementation of TTaskDialog has been refactored.
    • Widgetset specific implementation has been moved to the widgetset.
    • The emulated taskdialog has been moved to a new unit: TaskDlgEmulation.
    • The unit LCLTaskDialog has been deprecated.
    • Remedy: if you use TTaskDialog from (now deprecated) unit LCLTaskDialog, use TTaskDialog from Dialogs unit instead.
  • Execute() now passes the handle of the active form instead of 0.
    • Reason: it makes Execute() honour the tfRelativeToWindow flag.
    • Remedy: if your code relied on passing 0 as the ParentWind parameter use Execute(0) instead.
  • The occurrence of '\n' in e.g. captions is no longer converted to a LineFeed.
    • Reasons:
      • Wrong results if the capion of a (radio)button is set to e.g. 'Save in "c:\new_folder\"'
      • You can have a LineFeed (#10) inside a Pascal string.
    • See also Issue #38676.
    • Remedy: use LineFeed character in captions where applicable.

TShellTreeView, TShellListView

  • The ReadOnly property of these controls has been changed to be true by default.
    • Reason: These controls, by default, do not propagate changes of their item/node captions to the file system. The old behaviour was confusing because the user was able to rename an item/node but had to notice that the change was not persistent without additional code.
    • Remedy: Applications using the shell controls only for selecting files and folders are not affected. In "file-manager" application types, however, the ReadOnly property must be changed explicitely to false so that the user can edit items/nodes again.


  • Previous behaviour: InitialDir was not updated after the dialog was executed.
  • New behaviour: InitialDir will be updated after the dialog was executed. This also happens if the user cancels the dialog.
  • Reason: consistency with the behaviour of TOpenDialog.
  • Remedy: include ofNoChangeDir in DialogOptions
  • Commit: 4c4c9631

Components incompatibility


  • Utility functions PointDist and PointLineDist have been marked as being deprecated and replaced by PointDistSq and PointLineDistSq since they return the square of the distance rather than the distance itself.

SynEdit (in user apps)

  • The default Keystrokes for indent/unindent changed from Shift-Ctrl I/U to Ctrl I/U
    This affects only TSynEdit newly added to forms. Existing TSynEdit will load the old keystrokes. Action is only needed if TSynEdits are added to apps with other existing TSynEdit, and should be in sync.

Other release notes