Sign in Join
Wiki copytemporary

Lazarus For Delphi Users: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11This writeup is for people who are interested in Lazarus and already know Delphi. It describes the differences between the two.
22
33## Delphi -\> Lazarus
44
55Lazarus is a Rapid Application Development (RAD) tool like Delphi. That means it comes with a visual component library and an Integrated Development Environment (IDE). The Lazarus component library (LCL) is very similar to Delphi's Visual Component Library (VCL). Most Lazarus units, classes and properties have the same name and functionality as their equivalents in Delphi. This makes porting Delphi applications to Lazarus relatively easy. Even though Lazarus is in many respects an open source Delphi clone, the compatibility is not 100%.
66
77### The biggest differences between Lazarus and Delphi
88
99- Lazarus is completely open source
1010- Lazarus is written in a platform-independent way
1111- Lazarus uses the [[Free Pascal]] compiler (FPC)
1212
1313FPC runs on more than 15 platforms (see [[Platform list]]. But not all FPC packages and libraries have been ported to all 15 platforms, so Lazarus currently runs on:
1414
1515- Linux (i386, x86_64)
1616- FreeBSD (i386, x86_64)
1717- macOS (PowerPC, i386, x86_64, ARM64)
1818- Windows (i386, x86_64)
1919
2020> **Note:** Lazarus is not complete and nor, for that matter, is this text. We are always searching for new developers, packagers, porters, documentation writers...
2121
2222### The first thing to do when converting a Delphi project to Lazarus
2323
2424Having opened Lazarus, you should go to to **Tools** and then **Convert Delphi Project to Lazarus Project** (Since Lazarus 1.2.6 the menu structure is **Tools** -\> **Delphi Conversion** -\> **Convert Delphi Project to Lazarus Project**). This won't do everything for you, but nonetheless will take you a good deal of the way. Note that the Lazarus IDE's conversion tools are generally one-way conversions. If you need to retain Delphi compatibility (so you can compile your project with both Delphi and Lazarus) consider converting your files with the [XDev Toolkit](http://wiki.lazarus.freepascal.org/XDev_Toolkit) instead.
2525
2626### Unicode support
2727
2828Versions of Delphi up to Delphi 2007 didn't support Unicode, but used Windows ANSI encoding. Delphi supports Unicode by using UTF-16 encoded strings from the 2009 version.
2929
3030Lazarus on the other hand started its Unicode support earlier and uses UTF-8 encoded strings. For more information see [[LCL Unicode Support]].
3131
3232## Delphi IDE -\> Lazarus IDE
3333
3434### Projects
3535
3636The main file for a Delphi application is its .dpr file. A Delphi .dpr file is both the program main source, and also the file where the Delphi IDE stores information about relevant compiler switches and unit locations.\
3737A Lazarus application has a corresponding .lpr file, which is also the principal **Pascal source** file for the project. However, the main file of a Lazarus project is the .lpi file (Lazarus Project Information), which is created separately together with the .lpr file. All project-specific information (such as compiler switches used, paths to units used etc.) is stored in the .lpi file. So, the important file is the .lpi file. On most platforms, double-clicking on an .lpi file in the system's file explorer will start the Lazarus IDE with that project open.
3838
3939For example:
4040
4141Delphi stores the paths of the project's units in the .dpr file. For instance:
4242
43-` unit1 in 'path/Unit1.pas';`
43+```text
44+ unit1 in 'path/Unit1.pas';
45+```
4446
4547These 'in' paths are Delphi-specific and are not read by the Lazarus IDE. Don't use them. Instead, in the Project Options dialog (**Project**-\>**Project Options...**) use the **Paths** page under **Compiler Options** to set unit paths where they differ from the project directory path. Note that most unit paths you will need are set automatically by the IDE when any package dependency is added. For instance, all standard Lazarus LCL projects have the LCL added as a dependency by default, and so any new Lazarus LCL project (**Project**-\>**New Project**-\>**Application**) knows all paths to all LCL compiled units without further work on your part.
4648
4749Delphi stores compiler options in the .dpr file. For instance {\$APPTYPE CONSOLE}. These are ignored by the Lazarus IDE. Don't use them. Use the Compiler Options page of the Project Options dialog instead.
4850
4951### No "empty" IDE with Lazarus
5052
5153One important rule: There is *always* a project. The only way to "close" a project is to exit Lazarus, or open another project. This is because a Lazarus project is also a "session". So session information (e. g. the current editor settings) is also stored in the .lpi file and the Lazarus editor is restored to its last saved state when the project is later reopened. For example: You are debugging an application, and set a lot of breakpoints and bookmarks. You can save the project at any time, close Lazarus or open another project. When you reopen the project (even on another computer) all your breakpoints, bookmarks, open files, cursor positions, jump histories, etc. are restored.
5254
5355### Source Editor
5456
5557Nearly all keys and short cuts can be defined in Tools -\> Options -\> Editor -\> Key Mappings
5658
5759The Lazarus IDE has a lot of tools for sources. Many of them look and work very similar to Delphi. But there is one important difference: Lazarus does not use the compiler to get code information. It parses the sources directly. This has a lot of important advantages:
5860
5961The source editor works with "comments". For Delphi the comments in the source are just space between code. No code feature works there and when new code is auto inserted, your comments will travel. Under Lazarus you can do a find declaration even on code in comments. Although this is not completely reliable, it often works. And when new code is inserted, the IDE uses some heuristics to keep comment and code together. For example: It will not split the line "c: char; // comment".
6062
6163Delphi's "Code Completion" (Ctrl+Space) is called "Identifier Completion" under Lazarus. The Lazarus term "Code Completion" is a feature, combining "Automatic Class Completion" (same as under Delphi), "Local Variable Completion" and "Event Assignment Completion". All of them are invoked by Ctrl+Shift+C and the IDE determines by the cursor position, what is meant.
6264
6365#### Example for Local Variable Completion
6466
6567Assume you just created a new method and wrote the statement "i:=3;"
6668
6769``` pascal
6870procedure TForm1.DoSomething;
6971begin
7072 i := 3;
7173end;
7274```
7375
7476Position the cursor over the identifier "i" and press `Ctrl`+`Shift`+`C` to get:
7577
7678``` pascal
7779procedure TForm1.DoSomething;
7880var i: Integer;
7981begin
8082 i := 3;
8183end;
8284```
8385
8486#### Example for Event Assignment Completion
8587
8688A nice feature of the object inspector is to auto create methods. You can get the source editor to create the events too.\
8789For example:
8890
8991``` pascal
9092Button1.OnClick:=
9193```
9294
9395Position the cursor behind the assign operator ":=" and press `Ctrl`+`Shift`+`C` to get:
9496
9597``` pascal
9698procedure TForm1.FormCreate(Sender: TObject);
9799begin
98100 Button1.OnClick:=@Button1Click;
99101end;
100102
101103procedure TForm1.Button1Click(Sender: TObject);
102104begin
103105
104106end;
105107```
106108
107109#### Example for Procedure Call Completion
108110
109111Assume you just wrote the statement "DoSomething(Width);"
110112
111113``` pascal
112114procedure SomeProcedure;
113115var
114116 Width: integer;
115117begin
116118 Width:=3;
117119 DoSomething(Width);
118120end;
119121```
120122
121123Position the cursor over the identifier "DoSomething" and press `Ctrl`+`Shift`+`C` to get:
122124
123125``` pascal
124126procedure DoSomething(aWidth: LongInt);
125127begin
126128
127129end;
128130
129131procedure SomeProcedure;
130132var
131133 Width: integer;
132134begin
133135 Width:=3;
134136 DoSomething(Width);
135137end;
136138```
137139
138140#### "Word Completion" Ctrl+W
139141
140142It works similar to the "Identifier Completion", but it does not work on pascal identifiers, but on all words. It lets you choose of all words in all open files beginning with the same letters.
141143
142144#### Supports Include files
143145
144146Delphi didn't support them, and so you probably haven't created many include files yet. But include files have a big advantage: They make it possible writing platform (in)dependent code without messing your code with IFDEFs. For example: Method jumping, Class Completion, find declaration, .. all work with include files.
145147
146148There are many options for the code features.
147149
148150### Designer
149151
150152\- Guidelines
151153
152154#### Object Inspector
153155
154156In the Delphi and Lazarus IDE's the Object Inspector is used to edit component properties and assign events etc. The following are a few minor differences to note in use :
155157
1561581. Starting in Delphi 5 there is an Object Treeview which can be used to navigate and select objects according to hierarchy in addition to the traditional drop down list in the Object Inspector. In Lazarus this is part of the Object Inspector and is used in place of the default drop-down, you can select to use/not use it from the right click menu with "Show Component Tree"
1571592. In Delphi double clicking on a blank event will auto create one and open the Source Editor to that position, in Lazarus there is a button to the right of the selected drop-down which performs this action instead.
1581603. In Delphi you must manually delete the name of an event in the edit to remove the attatchement, in Lazarus you can drop down and select "(None)".
1591614. Similarly to Events, double clicking regular properties such as boolean will not change the value, you must select it from a drop down. And to open those with an assigned editor form, you must click the '...' button to the right of the edit/drop-down
160162
161163#### Packages
162164
163165Can Lazarus install and use Delphi Packages?
164166
165167
166168No, because they require Delphi compiler magic.
167169
168170Do we need ones specially made for lazarus?
169171
170172
171173Yes.
172174
173175Create a new package, save it in the package source directory (normally same directory of the .dpk file), add the LCL as required package and finally add the .pas files. You can install it, or use it in your projects now. There are some [[packages|differences between Lazarus and Delphi packages]]
174176
175177## VCL -\> LCL
176178
177179While the VCL and the LCL both serve much of the same purpose - of an Object Oriented Component Hierarchy especially geared toward rapid application development, they are not identical. For instance while the VCL provides many non-visual components, the LCL tries to only provide visual, while most non-visual components (such as db access) are provided by the FCL, included with [[Free Pascal]] .
178180
179181Additionally many controls may not exist in the LCL that are in the VCL, or vice versa, or even when controls do exist in both, they are not clones, and changes must be made in applications, components and controls if porting.
180182
181183The following is an attempt to provide fairly complete descriptions of major differences or incompatiblities between the two for the Delphi user. It covers differences primarily with the VCL of D4 especially, though at times D5, D6, or D7 as well; and with the current LCL, as is in CVS. As such it may not always be accurate to the version of Delphi you are used to, or completely match the current LCL you have. If you see inacuracies between the following and the LCL as in CVS, or your Delphi feel free to append and modify so as to keep this as comprehensive as possible for all people.
182184
183185### TControl.Font/TControl.ParentFont
184186
185187In the VCL it is quite common and normal to use a specific font name and font properties such as bold and italics for controls, and expect this value to always be followed. Further is provided the TControl.ParentFont property which ensures that a control will always follow its parent's font. Again the implicit assumption being that these values will always be followed, even regardless of Windows Apearance Settings.
186188
187189This is not always true in the LCL, nor can it be. The LCL being cross-platform/cross-interface in nature prefers to take a balanced aproach, and instead will always try to use native Desktop/Toolkit Apearance or Theme settings on any widgets. For example if using a GTK interface, and the gtk theme supplies a specific font for buttons, then LCL buttons will always try to use this font.
188190
189191This means that most LCL controls do not have the same level of design control that is often expected in the VCL, rather only those custom controls which are Canvas drawn instead of interface allocated can consistantly be modified in this manner regardless of the Interface used.
190192
191193### Control Dragging/Docking
192194
193195In the VCL most (Win)Controls implement methods and [[callback]] functions for handling dragging and docking of controls, eg. dragging a control from one panel, and docking it onto another panel at run time.
194196
195197This functionality is currently unimplemented/unfinished in the LCL, though it is currently in the initial stages of planning, and should eventually support some level of compatibility for this type of behavior, if not in the exact same manner.
196198
197199This currently means that no Control will inherit/use the following TControl functions, procedures, properties, or events -
198200
199201``` pascal
200202Protected
201203 function GetDockEdge(MousePos: TPoint): TAlign;
202204 function GetDragImages: TDragImageList;
203205 function GetFloating: Boolean;
204206 function GetFloatingDockSiteClass: TWinControlClass;
205207 procedure DoEndDrag(Target:TObject); X, Y: Integer);
206208 procedure DockTrackNoTarget(Source: TDragDockObject; X, Y: Integer);
207209 procedure DoEndDock(Target: TObject; X, Y: Integer);
208210 procedure DoDock(NewDockSite: TWinControl; var ARect: TRect);
209211 procedure DoStartDock(var DragObject: TDragObject);
210212 procedure DragCanceled;
211213 procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
212214 var Accept: Boolean);
213215 procedure DoEndDrag(Target: TObject; X, Y: Integer);
214216 procedure DoStartDrag(var DragObject: TDragObject);
215217 procedure DrawDragDockImage(DragDockObject: TDragDockObject);
216218 procedure EraseDragDockImage(DragDockObject: TDragDockObject);
217219 procedure PositionDockRect(DragDockObject: TDragDockObject);
218220 procedure SetDragMode(Value: TDragMode);
219221 property DragKind: TDragKind;
220222 property DragCursor: TCursor;
221223 property DragMode: TDragMode;
222224 property OnDragDrop: TDragDropEvent;
223225 property OnDragOver: TDragOverEvent;
224226 property OnEndDock: TEndDragEvent;
225227 property OnEndDrag: TEndDragEvent;
226228 property OnStartDock: TStartDockEvent;
227229 property OnStartDrag: TStartDragEvent;
228230public
229231 function Dragging: Boolean;
230232 function ManualDock(NewDockSite: TWinControl; DropControl: TControl;
231233 ControlSide: TAlign): Boolean;
232234 function ManualFloat(ScreenPos: TRect): Boolean;
233235 function ReplaceDockedControl(Control: TControl; NewDockSite: TWinControl;
234236 DropControl: TControl; ControlSide: TAlign): Boolean;
235237 procedure BeginDrag(Immediate: Boolean; Threshold: Integer);
236238 procedure Dock(NewDockSite: TWinControl; ARect: TRect);
237239 procedure DragDrop(Source: TObject; X, Y: Integer);
238240 procedure EndDrag(Drop: Boolean);
239241 property DockOrientation: TDockOrientation;
240242 property Floating: Boolean;
241243 property FloatingDockSiteClass: TWinControlClass;
242244 property HostDockSite: TWinControl;
243245 property LRDockWidth: Integer;
244246 property TBDockHeight: Integer;
245247 property UndockHeight: Integer;
246248 property UndockWidth: Integer;
247249```
248250
249251that the following classes do not exist/are unusable -
250252
251253``` pascal
252254TDragImageList = class(TCustomImageList)
253255TDockZone = class
254256TDockTree = class(TInterfacedObject, IDockManager)
255257TDragObject = class(TObject)
256258TBaseDragControlObject = class(TDragObject)
257259TDragControlObject = class(TBaseDragControlObject)
258260TDragDockObject = class(TBaseDragControlObject)
259261```
260262
261263and that the following functions are also unusable/incompatible -
262264
263265``` pascal
264266function FindDragTarget(const Pos: TPoint;
265267 AllowDisabled: Boolean) : TControl;
266268procedure CancelDrag;
267269function IsDragObject(sender: TObject): Boolean;
268270```
269271
270272The start of docking manager is described here: [[Anchor Docking]]
271273
272274### TEdit/TCustomEdit
273275
274276The Edit controls, while functioning essentialy the same in the LCL as the VCL, do have some issues to be aware of in converting -
275277
2762781. Due to restrictions in the Interfaces, TEdit.PasswordChar does not work in all interfaces yet(though in time it may), instead TCustomEdit.EchoMode emPassword should be used in the event text needs to be hidden.
2772792. On Drag/Dock Events are not yet implemented. For more information please see earlier section on Control Dragging/Docking.
2782803. Font Properties are usually ignored for interface consistancy, for detailed explanation as too why please see TControl.Font/TControl.ParentFont
279281
280282### TDBImage
281283
282284Delphi and Lazarus both have a [[TDBImage]] control that shows images stored in a database field. In current stable versions (1.2.4), Lazarus stores information about the image type in the database field before the actual image data. See procedure *TDBImage.UpdateData* This means that Delphi and older Lazarus implementations are not compatible.
283285
284286Current stable Lazarus (1.2.0+) has implemented changes that allow Delphi compatible behaviour. Please see [[Lazarus 1.2.0 release notes|Lazarus_1.2.0_release_notes#TDBImage]] for details on how to activate this.
285287
286288Current Lazarus trunk falls back to Delphi-compatible behaviour on reading Delphi-formatted database fields into TDBImage.
287289
288290### (optional) TSplitter -\> TPairSplitter
289291
290292**Please Improve Me**
291293
292294There is now a [[TSplitter]] control in the LCL, so no need to convert it.
293295
294296Nevertheless, if you want, here it is explained:
295297
296298The following is loosely based on questions by Vincent Snijders on the mailing list, and responses by [Andrew Johnson](http://lazarus-ccr.sourceforge.net/index.php?wiki=AndrewJohnson):
297299
298300In the VCL, "Splitting" controls, that is a handle which can be dragged between two components to give one more or less space then the other, is accomplished by a TSplitter. This is often seen, for instance in the Delphi IDE between the docked Code Explorer and Source Viewer.
299301
300302The LCL provides its own Control called a TPairSplitter, which serves the same type of purpose, however it is not compatible, so "repairing" broken VCL code or Delphi DFM's will be necessary in the event of porting code, even though much is shared in common between the two.
301303
302304So what exactly are the differences?
303305
304306Well the biggest differences are a VCL TSplitter has no children, instead it is placed between two controls aligned properly, and allows resizing between them at runtime, regardless its own size. It must have two controls aligned on each side to do anything. A simple example would be form with a Left Aligned Panel, a left aligned Splitter, and a second client aligned panel. On run time you could then realign the size given each panel by dragging on the handle provided by this Splitter control.
305307
306308On the LCL hand however, a TPairSplitter is a special kind of control, with two panels, and it can only be usefull if the controls to split are on these panels, but it will still perform a split between those panel whether or not anything is on them. So following the prior example, you would have a form with a TPairSplitter aligned client, and a panel aligned client on its left side, and a panel aligned client on its right side.
307309
308310The other important difference is that in the VCl, since the TSplitter is its own TControl, then the position is kept relative to the other controls on resize, so for instance a client panel will grow while the other panels will not, thus the split position is relative to the alignment of the split controls,
309311
310312In the LCL since the side panels are separate then the TPairSplitter has a Position property which is absolute relative to top or left. so on resize the actual position does not change according to contents, so a callback must be set to ensure the ratio is kept on resize if this is important.
311313
312314For example if the Right side of a vertical split needs to have alClient like behaviour, you need to add a form resize callback which does something like :
313315
314-`PairSplitter.Position := PairSplitter.Width - PairSplitter.Position; `
316+``` pascal
317+PairSplitter.Position := PairSplitter.Width - PairSplitter.Position;
318+```
315319
316320So how can I convert existing code using TSplitter to the TPairSplitter?
317321
318322If the splitter and controls are created within an actual function(like form oncreate), conversion shouldn't be too difficult, primarily reorganize the code to create the controls in order of new hierarchy and set the parents of the child controls to split to the left/top and right/bottom portions of the PairSplitter. An example of the changes being -
319323
320324**VCL**
321325
322326**LCL**
323327
324328``` pascal
325329var
326330 BottomPanel: TPanel;
327331 VerticalSplitter: TSplitter;
328332 LeftPanel: TPanel;
329333 HorizontalSplitter: TSplitter;
330334 MainPanel: TPanel;
331335
332336begin
333337 BottomPanel:= TPanel.Create(Self);
334338 with (BottomPanel) do
335339 begin
336340 Parent:= Self;
337341 Height:= 75;
338342 Align:= alBottom;
339343 end;
340344
341345 VerticalSplitter:= TSplitter.Create(Self);
342346 with (VerticalSplitter) do
343347 begin
344348 Parent:= Self;
345349 Align:= alBottom;
346350 end;
347351
348352 HorizontalSplitter:= TSplitter.Create(Self);
349353 with (HorizontalSplitter) do
350354 begin
351355 Parent:= Self;
352356 align:= alLeft;
353357 end;
354358
355359 LeftPanel:= TPanel.Create(Self);
356360 with (LeftPanel) do
357361 begin
358362 Parent:= Self;
359363 Width:= 125;
360364 Align:= alLeft;
361365 end;
362366
363367 MainPanel:= TPanel.Create(Self);
364368 with (MainPanel) do
365369 begin
366370 Parent:= Self;
367371 Align:= alClient;
368372 Caption:= 'Hello';
369373 end;
370374end;
371375```
372376
373377``` pascal
374378var
375379 BottomPanel: TPanel;
376380 VerticalSplitter: TPairSplitter;
377381 LeftPanel: TPanel;
378382 HorizontalSplitter: TPairSplitter;
379383 MainPanel: TPanel;
380384
381385begin
382386 VerticalSplitter:= TPairSplitter.Create(Self);
383387 with (VerticalSplitter) do
384388 begin
385389 Parent:= Self;
386390 Align:= alClient;
387391 Width:= Self.Width;
388392 Height:= Self.Height;
389393 SplitterType:= pstVertical;
390394 Position:= Height - 75;
391395 Sides[0].Width:= Width;
392396 Sides[0].Height:= Position;
393397 end;
394398
395399 HorizontalSplitter:= TPairSplitter.Create(Self);
396400 with (HorizontalSplitter) do
397401 begin
398402 Parent:= VerticalSplitter.Sides[0];
399403 Width:= Self.Width;
400404 Height:= VerticalSplitter.Position;
401405 align:= alClient;
402406 SplitterType:= pstHorizontal;
403407 Position:= 125;
404408 end;
405409
406410 LeftPanel:= TPanel.Create(Self);
407411 with (LeftPanel) do
408412 begin
409413 Parent:= HorizontalSplitter.Sides[0];
410414 Align:= alClient;
411415 end;
412416
413417 MainPanel:= TPanel.Create(Self);
414418 with (MainPanel) do
415419 begin
416420 Parent:= HorizontalSplitter.Sides[1];
417421 Align:= alClient;
418422 Caption:= 'Hello';
419423 end;
420424
421425 BottomPanel:= TPanel.Create(Self);
422426 with (BottomPanel) do
423427 begin
424428 Parent:= VerticalSplitter.Sides[1];
425429 Align:= alClient;
426430 end;
427431end;
428432```
429433
430434So as you can see, farely consistant with most control hierarchy. And if you are familiar with DFM's, the changes needed for DFM-\>LFM conversion should be farely obvious from the above, as they are the same sort of changes in Parent/Owner etc.
431435
432436So the above example would be something like -
433437
434438**Delphi DFM**
435439
436440**(extraneous values removed)**
437441
438442**Lazarus LFM**
439443
440444**(most width, height, etc. removed)**
441445
442-``` pascal
446+``` lfm
443447object VerticalSplitter: TSplitter
444448 Height = 3
445449 Cursor = crVSplit
446450 Align = alBottom
447451end
448452object HorizontalSplitter: TSplitter
449453 Width = 3
450454 Align = alLeft
451455end
452456object BottomPanel: TPanel
453457 Height = 75
454458 Align = alBottom
455459end
456460object LeftPanel: TPanel
457461 Width = 125
458462 Align = alLeft
459463end
460464object MainPanel: TPanel
461465 Align = alClient
462466end
463467```
464468
465-``` pascal
469+``` lfm
466470object VerticalSplitter: TPairSplitter
467471 Align = alClient
468472 SplitterType = pstVertical
469473 Position = 225
470474 Height = 300
471475 Width = 400
472476 object Pairsplitterside1: TPairSplitterIde
473477 object HorizontalSplitter: TPairSplitter
474478 Align = alClient
475479 Position = 125
476480 object Pairsplitterside3: TPairSplitterIde
477481 Width = 125
478482 object LeftPanel: TPanel
479483 Align = alClient
480484 Width = 125
481485 end
482486 end
483487 object Pairsplitterside4: TPairSplitterIde
484488 object MainPanel: TPanel
485489 Align = alClient
486490 end
487491 end
488492 end
489493 end
490494 object Pairsplitterside2: TPairSplitterIde
491495 object BottomPanel: TPanel
492496 Align = alClient
493497 Height = 75
494498 end
495499 end
496500end
497501```
498502
499503### TCustomTreeView/TTreeView
500504
501505Both VCL and the LCL provide a TCustomTreeView/TTreeView component, used for tree structured lists of data with multiple nodes and advanced selection and Image lists, and while actual features are comparable, not all properties are entirely compatible. Primary differences are as follows -
502506
503507**Incomplete list, also update to include TCustomTreeView Mark functions and protected methods**
504508
5055091. The LCL provides a TCustomTreeView.Options, a set of options which can be set on the control to change its behaviour and apearance. These options are :
506510 - tvoAllowMultiselect - enables multi node select mode, equivalent to enabling TCustomTreeView.MultiSelect in the D6 VCL
507511 - tvoAutoExpand - Auto Expand nodes, equivalent to enabling TCustomTreeView.AutoExpand
508512 - tvoAutoInsertMark - Update the Drag preview on mouse move.
509513 - tvoAutoItemHeight - Adjust the item heights automatically.
510514 - tvoHideSelection - Do not mark the selected item.
511515 - tvoHotTrack - use Hot Tracking, equivalent to enabling TCustomTreeview.HotTrack
512516 - tvoKeepCollapsedNodes - When shrinking/folding nodes, keep the child nodes
513517 - tvoReadOnly - make Treeview read only, equivalent to enabling TCustomTreeview.ReadOnly
514518 - tvoRightClickSelect - allow using Mouse Right Clicks to select nodes, equivalent to enabling TCustomTreeView.RightClickSelect
515519 - tvoRowSelect - allow selecting rows, equivalent to enabling TCustomTreeView.RowSelect
516520 - tvoShowButtons - show buttons, equivalent to enabling TCustomTreeView.ShowButtons
517521 - tvoShowLines - show node lines, equivalent to enabling TCustomTreeView.ShowLines
518522 - tvoShowRoot - show root note, equivalent to enabling TCustomTreeView.ShowRoot
519523 - tvoShowSeparators - show seperators
520524 - tvoToolTips - show tooltips for individual nodes
5215252. The LCL provides additional properties:
522526 - TCustomTreeView.OnSelectionChange event
523527 - TCustomTreeView.DefaultItems, for the default number of Items
524528 - TCustomTreeView.ExpandSignType to determine sign used on expandable/collapsible nodes
5255293. While most On Drag/Dock Events are available in the LCL they do not work. For more information please see earlier section on Control Dragging/Docking.
526530
527531### Messages / Events
528532
529533The order and frequency of messages and events (OnShow, OnActivate, OnEnter, ...) differ from the VCL and depend on the [[Widgetset|widgetset]]. The LCL provides a subset of WinAPI like messages to make porting of Delphi components easier, but almost all LCL messages work a little bit different than the VCL/WinAPI counterpart. The biggest part of Delphi code using WinAPI messages uses them, because the VCL lacks a feature or for speed reasons. Such things will seldom work the same under the LCL, so they must be checked manually. That's why LCL messages are called for example LM_SIZE instead of WM_SIZE (unit lmessages).
530534
531535**Note on handling of custom messages!** As of version 0.9.26 (December 2008), way of handling custom WinApi messages (e.g. WM_HOTKEY, WM_SYSCOMMAND) differs from the way of handling these messages in Delphi. At the moment you cannot handle them via **message** directive or via overriding of *WndProc* method of the form. The only way to handle them in the form is to hook Windows *windowproc* by yourself. Read more here: [[Win32/64 Interface|Processing non-user messages in your window]]
532536
533537## See also
534538
535539- [[Delphi language features missing from the Free Pascal Compiler]]
536540- [[Code Conversion Guide|Code Conversion Guide (from Delphi & Kylix)]]
537541- [[Compile With Delphi]]
538542
539543---
540544*From the Free Pascal wiki, page "Lazarus For Delphi Users", as it stood on 2022-05-31 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history