Difference between revisions of "Lazarus For Delphi Users/es"

From Lazarus wiki
Jump to navigationJump to search
Line 10: Line 10:
 
   Lazarus es completamente libre, está escrito para ser independiente de la plataforma y utiliza el potente compilador [[Free Pascal]] (FPC). FPC está disponible para más de 15 plataformas. No obstante lo anterior, no todas las librerías y paquetes están disponibles en todas ellas, Lazarus  a día de hoy funciona en Linux (i386, x86_64), FreeBSD (i386), MacOSX (powerpc, i386) y Windows (i386, x86_64).
 
   Lazarus es completamente libre, está escrito para ser independiente de la plataforma y utiliza el potente compilador [[Free Pascal]] (FPC). FPC está disponible para más de 15 plataformas. No obstante lo anterior, no todas las librerías y paquetes están disponibles en todas ellas, Lazarus  a día de hoy funciona en Linux (i386, x86_64), FreeBSD (i386), MacOSX (powerpc, i386) y Windows (i386, x86_64).
  
====Lazarus no está terminado del todo, y del mismo modo, tampoco este texto. Se buscan nuevos programadores, escritores de paquetes, traductores, escritores de documentación, ...====
+
'''   Lazarus no está terminado del todo, y del mismo modo, tampoco este texto. Se buscan nuevos programadores, escritores de paquetes, traductores, escritores de documentación, ...'''
  
 
=== Lo primero que hay que hacer al convertir un proyecto de Delphi ===
 
=== Lo primero que hay que hacer al convertir un proyecto de Delphi ===

Revision as of 20:27, 15 January 2009

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) 한국어 (ko) português (pt) русский (ru) slovenčina (sk)

Este escrito está dirigido a usuarios interesados en Lazarus que conocen Delphi, ya que describe las diferencias entre ambos.

Delphi -> Lazarus

   Lazarus es una herramienta de desarrollo rápido de aplicaciones, al igual que Delphi. Esto significa que dispone de una biblioteca de componentes visuales y de un entorno de desarrollo integrado (IDE). La librería de componentes de Lazarus (LCL) es muy similar a la VCL de Delphi. Muchas unidades, clases y propiedades tienen el mismo nombre e idéntica funcionalidad. Esto hace que el paso de uno o otro sea fácil. Pero Lazarus no es un clon Delphi de fuentes libres. So don't expect 100% compatibility.

La mayor diferencia

   Lazarus es completamente libre, está escrito para ser independiente de la plataforma y utiliza el potente compilador Free Pascal (FPC). FPC está disponible para más de 15 plataformas. No obstante lo anterior, no todas las librerías y paquetes están disponibles en todas ellas, Lazarus a día de hoy funciona en Linux (i386, x86_64), FreeBSD (i386), MacOSX (powerpc, i386) y Windows (i386, x86_64).

   Lazarus no está terminado del todo, y del mismo modo, tampoco este texto. Se buscan nuevos programadores, escritores de paquetes, traductores, escritores de documentación, ...

Lo primero que hay que hacer al convertir un proyecto de Delphi

   Teniendo Lazarus en ejecución, tienes que ir a Herramientas y después a Convertir proyecto Delphi a proyecto Lazarus. Esto no lo hace todo, pero te facilitará la conversión. Tenga en cuenta que las herramientas disponibles en el IDE son unidireccionales. Si se necesita conservar la compatibilidad, para poder compilar indistintamente en Delphi y en Lazarus, considera convertir tus archivos utilizando XDev Toolkit.

Delphi IDE -> Lazarus IDE

Proyectos

   El archivo de extensión .dpr es el principal de una aplicación Delphi. El archivo principal de un proyecto Lazarus es el de extensión .lpi (Información de proyecto Lazarus). El archivo .dpr es también el arcivo principal de código y en el mismo el IDE almacena información sobre las opciones de compilación y las unidades que utiliza el proyecto. Una aplicación Lazarus también tiene un archivo .lpr, que es el archivo principal de código. El resto de la información se lamacena en el .lpi. Por lo tanto el .lpi es el archivo más importante del proyecto.

   Por ejemplo:

   Delphi guarda las rutas a las unidades en el archivo .dpr. Como esta, unidad1 in 'ruta/Unidad1.pas'. El in es específico de Delphi y no es entendido por Lazarus. No lo utilices, en su lugar usa las opciones de unidades y rutas de configuración del compilador.

   Delphi guarda las opciones del compilador en el archivo .dpr, como {$APPTYPE CONSOLE}, que son ignoradas por Lazarus. No lo utilices, en su lugar usa las opciones del compilador.

Una cuestión importante: Siempre hay un proyecto.

   La única forma de "cerrar" un proyecto es cerrando Lazarus o abriendo otro proyecto. ESto es así, porque un proyecto Lazarus es así mimso una "sesión". Esto significa que la configuración actual del IDE se guarda en el archivo .lpi y es restaurada al reabrir el proyecto. Por ejemplo: estás depurando una aplicación, pones una serie de puntos de parada y marcas. Puedes guardar el proyecto, cerrar Lazarus o abrir otro proyecto. Cuándo reabras el proyecto, incluso en otra máquina, todos los puntos de parada, marcadores, archivos abiertos en el editor, posición de los cursosres, hisoria de saltos, y demás, serán restaurados.

Editor de Código

   Casi todas las funciones asignadas a teclas y los accesos directos se puede definir en Entorno -> Opciones del editor -> Accesos rápidos.

   El IDE de Lazarus tiene una gran cantidad de herramientas para trabajar con el código fuente. Muchas son parecidas y trabajan de forma similar a las de Delphi. Pero hay una diferencia importante, Lazarus no utiliza el compilador para obtener información del código, analiza el código fuente directamente. Esto tiene un montón de ventajas importantes:

   El editor trabaja con "comentarios". Para Delphi los comentarios son simplemente espacios entre el código. Ninguna característica del código trabaja aquí y si se inserta automáticamente nuevo código, los comentarios se desplazan. Con Lazarus se puede encontrar una declaración de código incluso dentro de los comentarios. Aunque esto no es completamente fiable, normalmente funciona. Cuando se inserta nuevo código el IDE utiliza heurística para mantener los comentarios y el código juntos. Por ejemplo, no separará la línea: <delphi> letra: char; // comentario</delphi>

   La función de Completar código de Delphi (Ctrl+Space) se denomina Completar identificador (Identifier Completion) en Lazarus. El término Lazarus Completar código (Code Completion) es una funcionalidad que combina Completar Clase automáticamente (Automatic Class Completion igual que en Delphi), Completar variable local (Local Variable Completion) y Completar asignación de evento (Event Assignment Completion. Todas ellas se activan mediante Ctrl+Shift+C y el IDE determina cuál ejecutaraá en función del código presente en la posición del cursor.

Ejemplo de Completar variable local

   Supongamos que acabas de crear un nuevo método y escribes la sentencia "i:=3;" <delphi>

procedure TForm1.HacerAlgo;
 begin
  i := 3;
 end;

</delphi>

   Coloca el cursor justo de delante del identificador "i" y presiona Ctrl+Shift+C para obtener la declaración de la variable:

<delphi>

procedure TForm1.HacerAlgo;
 var i: Integer;
 begin
  i := 3;
 end;

</delphi>

Ejemplo Completar asignación de evento

   Una buena característica del inspector de objetos es crear métodos automáticamente. Se puede hacer lo mismo en el editor de código.
   Por ejemplo:

<delphi> btnCancelar.OnClick:=</delphi>

   Sitúa el cursor tras el operador de asignación ":=" y presiona Ctrl+Shift+C, y se generará el esqueleto de la función de respuesta al evento.

<delphi>//...

 btnCancelar.OnClick:=@btnCancelarClick;

//...

procedure Form1.btnCancelarClick(Sender : TObject);
 begin
 end;    </delphi>

Ejemplo de Completar llamada a Procedimiento

   Supongamos que acabamos de escribir la sentencia "HacerAlgo(Ancho);" en este código <delphi> procedure UnProcedimiento;

 var
  Ancho: integer;
 begin
  Ancho:=3;
  HacerAlgo(Ancho);
 end;</delphi>

   Sitúa el cursor sobre el identificador "HacerAlgo" y presiona las teclas Ctrl+Shift+C para obtener:

<delphi> procedure HacerAlgo(aAncho: LongInt);

 begin
 end;

//...

procedure UnProcedimiento;
 var
  Ancho: integer;
 begin
  Ancho:=3;
  HacerAlgo(Ancho);
 end;</delphi>

   Nota del traductor: lo descrito más arriba no funciona (da un error: Ya fue definido el identificador UnProcedimiento); sin embargo si el cursor está dentro del código de "UnProcedimiento", cómo en el ejemplo: <delphi> type

   UnaClase = Class(TObject)
   end;

//...

procedure UnaClase.UnProcedimiento;
 begin
 //...
 end;</delphi>

   Al pulsar Ctrl+Shift+C obtendremos la definición de UnProcedimiento como miembro de la clase "UnaClase". <delphi> type

   UnaClase = Class(TObject)
    private
     procedure  UnProcedimiento;
    end;

//... procedure UnaClase.UnProcedimiento;</delphi>

"Completar palabras" Ctrl+W

   Trabaja de forma parecida a Completar identificador, sólo que no trabaja con identificadores pascal, sino con cualquier palabra. Busca en los ficheros abiertos todas las palabras que comienzan con las letras precedentes.

Borrar hasta el final de la línea: Ctrl+T

Borrar la línea completa: Ctrl+Y

Acceder a las plantillas de código: Ctrl+J

Permite archivos de inclusión (include)

    Mediante la directiva {$i acrchivo.inc}. Delphi también permite usarlos (comprobado en D3 y D7, en D/ además se utiliza), aunque que probablemente no has creado muchos archivos de inclusión. Estos archivos tienen una gran ventaja: permiten escribir código (in)dependiente de la plataforma sin llenar el código de directivas IFDEF. Por ejemplo: Saltar al procedimiento (procedure jump), Completar clase, buscar declaración, ... funcionan con los archivos de inclusión.

   Hay otras muchas opciones para trabajar con el código.

Diseñador

  • Directrices

Inspector de Objetos

   En Delphi y Lazarus el Inspector de Objetos se utiliza para editar las propiedades de los componentes y la asignación de los eventos. Estas son lagunas de las pequeñas diferencias que hay entre ambos:

  1. Con Delphi 5 apareció una vista jerarquizada en árbol de los componentes (Object Treeview), que se podía usar para moverse por los objetos y seleccionarlos, además de la tradicional lista desplegable del Inspector. En Lazarus esta vista de árbol está integrada en el Inspector y se utiliza en sustitución de la lista desplegable. Se puede activar o desactivar su utilización mediante la opción Mostrar Árbol de componentes del menú contextual del Inspector .
  2. En Delphi haciendo doble clic en un evento vacío se crea este y se abre el Editor con el cursos en el mismo, en Lazarus, además de lo anterior, existe un botón al lado de la lista desplegable que hace lo mismo.
  3. En Delphi se puede borrar manualmente el nombre de un evento para deshacer el enlace, en Lazarus, además podemos seleccionar (none) en la lista desplegable.
  4. De forma similar, con doble clic en propiedades corrientes, cómo un lógico cambia su valor, además podemos seleccionarlo con la lista desplegable. Si la propiedad requiere de editor especializado, aparecerá este, al igual que si usamos el botón con los puntos suspensivos.

Paquetes

   ¿Se pueden instalar y usar paquetes Delphi en Lazarus?

   No de forma directa, porque necesitan la magia del compilador de Delphi.

   ¿Necesitamos entonces paquetes específicos para Lazarus ?

   Sí, para ello:

   Crea un nuevo paquete, guárdalo en el direcorio donde residen los archivos fuente (normalmente el mismo directorio del archivo .dpk), añade la LCL cómo pauete necesario y finalmente los archivos .pas. Ya puedes instalarlo o utilizarlo en tus proyectos. Hay algunas diferencias entre los paquetes de Lazarus y Delphi, leete el archivo docs/Packages.txt que se encuentra en el directorio de fuentes de Lazarus.

   Ver tambien la Guía de conversión de código entre Delphi y Lazarus

VCL -> LCL

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

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

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

TControl.Font/TControl.ParentFont

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

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

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

Control Dragging/Docking

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

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

This currently means that no Control will inherit/use the following TControl functions, procedures, properties, or events - <delphi> Protected

 function GetDockEdge(MousePos: TPoint): TAlign;
 function GetDragImages: TDragImageList;
 function GetFloating: Boolean;
 function GetFloatingDockSiteClass: TWinControlClass;
 procedure DoEndDrag(Target:TObject); X, Y: Integer);
 procedure DockTrackNoTarget(Source: TDragDockObject; X, Y: Integer);
 procedure DoEndDock(Target: TObject; X, Y: Integer);
 procedure DoDock(NewDockSite: TWinControl; var ARect: TRect);
 procedure DoStartDock(var DragObject: TDragObject);
 procedure DragCanceled;
 procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
                   var Accept: Boolean);
 procedure DoEndDrag(Target: TObject; X, Y: Integer);
 procedure DoStartDrag(var DragObject: TDragObject);
 procedure DrawDragDockImage(DragDockObject: TDragDockObject);
 procedure EraseDragDockImage(DragDockObject: TDragDockObject);
 procedure PositionDockRect(DragDockObject: TDragDockObject);
 procedure SetDragMode(Value: TDragMode);
 property DragKind: TDragKind;
 property DragCursor: TCursor;
 property DragMode: TDragMode;
 property OnDragDrop: TDragDropEvent;
 property OnDragOver: TDragOverEvent;
 property OnEndDock: TEndDragEvent;
 property OnEndDrag: TEndDragEvent;
 property OnStartDock: TStartDockEvent;
 property OnStartDrag: TStartDragEvent;

public

 function Dragging: Boolean;
 function ManualDock(NewDockSite: TWinControl; DropControl: TControl;
                    ControlSide: TAlign): Boolean;
 function ManualFloat(ScreenPos: TRect): Boolean;
 function ReplaceDockedControl(Control: TControl; NewDockSite: TWinControl;
                     DropControl: TControl; ControlSide: TAlign): Boolean;
 procedure BeginDrag(Immediate: Boolean; Threshold: Integer);
 procedure Dock(NewDockSite: TWinControl; ARect: TRect);
 procedure DragDrop(Source: TObject; X, Y: Integer);
 procedure EndDrag(Drop: Boolean);
 property DockOrientation: TDockOrientation;
 property Floating: Boolean;
 property FloatingDockSiteClass: TWinControlClass;
 property HostDockSite: TWinControl;
 property LRDockWidth: Integer;
 property TBDockHeight: Integer;
 property UndockHeight: Integer;
 property UndockWidth: Integer; 

</delphi>

that the following classes do not exist/are unusable -

<delphi> TDragImageList = class(TCustomImageList) TDockZone = class TDockTree = class(TInterfacedObject, IDockManager) TDragObject = class(TObject) TBaseDragControlObject = class(TDragObject) TDragControlObject = class(TBaseDragControlObject) TDragDockObject = class(TBaseDragControlObject) </delphi>

and that the following functions are also unusable/incompatible -

<delphi> function FindDragTarget(const Pos: TPoint;

                        AllowDisabled: Boolean) : TControl;

procedure CancelDrag; function IsDragObject(sender: TObject): Boolean; </delphi>

The start of docking manager is described here: Anchor Docking

TEdit/TCustomEdit

The Edit controls, while functioning essentialy the same in the LCL as the VCL, do have some issues to be aware of in converting -

  1. 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.
  2. On Drag/Dock Events are not yet implemented. For more information please see earlier section on Control Dragging/Docking.
  3. Font Properties are usually ignored for interface consistancy, for detailed explanation as too why please see TControl.Font/TControl.ParentFont

(optional) TSplitter -> TPairSplitter

Please Improve Me

There is now a TSplitter control in the LCL, so no need to convert it.

Nevertheless, if you want, here it is explained:

The following is loosely based on questions by Vincent Snijders on the mailing list, and responses by Andrew Johnson:

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

The 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 necesary in the event of porting code, even though much is shared in common between the two.

So what exactly are the differences?

Well 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 size 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.

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

The 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,

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

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

PairSplitter.Position := PairSplitter.Width - PairSplitter.Position; 
So how can I convert existing code using TSplitter to the TPairSplitter?

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

VCL LCL

<delphi> var

 BottomPanel: TPanel;
 VerticalSplitter: TSplitter;
 LeftPanel: TPanel;
 HorizontalSplitter: TSplitter;
 MainPanel: TPanel;

begin

 BottomPanel:= TPanel.Create(Self);
 with (BottomPanel) do
 begin
   Parent:= Self;
   Height:= 75;
   Align:= alBottom;
 end;
 VerticalSplitter:= TSplitter.Create(Self);
 with (VerticalSplitter) do
 begin
   Parent:= Self;
   Align:= alBottom;
 end;
 HorizontalSplitter:= TSplitter.Create(Self);
 with (HorizontalSplitter) do
 begin
   Parent:= Self;
   align:= alLeft;
 end;
 LeftPanel:= TPanel.Create(Self);
 with (LeftPanel) do
 begin
   Parent:= Self;
   Width:= 125;
   Align:= alLeft;
 end;
 MainPanel:= TPanel.Create(Self);
 with (MainPanel) do
 begin
   Parent:= Self;
   Align:= alClient;
   Caption:= 'Hello';
 end;

end; </delphi>

<delphi> var

 BottomPanel: TPanel;
 VerticalSplitter: TPairSplitter;
 LeftPanel: TPanel;
 HorizontalSplitter: TPairSplitter;
 MainPanel: TPanel;

begin

 VerticalSplitter:= TPairSplitter.Create(Self);
 with (VerticalSplitter) do
 begin
   Parent:= Self;
   Align:= alClient;
   Width:= Self.Width;
   Height:= Self.Height;
   SplitterType:= pstVertical;
   Position:= Height - 75;
   Sides[0].Width:= Width;
   Sides[0].Height:= Position;
 end;
 HorizontalSplitter:= TPairSplitter.Create(Self);
 with (HorizontalSplitter) do
 begin
   Parent:= VerticalSplitter.Sides[0];
   Width:= Self.Width;
   Height:= VerticalSplitter.Position;
   align:= alClient;
   SplitterType:= pstHorizontal;
   Position:= 125;
 end;
 LeftPanel:= TPanel.Create(Self);
 with (LeftPanel) do
 begin
   Parent:= HorizontalSplitter.Sides[0];
   Align:= alClient;
 end;
 MainPanel:= TPanel.Create(Self);
 with (MainPanel) do
 begin
   Parent:= HorizontalSplitter.Sides[1];
   Align:= alClient;
   Caption:= 'Hello';
 end;
 BottomPanel:= TPanel.Create(Self);
 with (BottomPanel) do
 begin
   Parent:= VerticalSplitter.Sides[1];
   Align:= alClient;
 end;

end; </delphi>

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

So the above example would be something like -

Delphi DFM
(extraneous values removed)
Lazarus LFM
(most width, height, etc. removed)

<delphi> object VerticalSplitter: TSplitter

 Height = 3
 Cursor = crVSplit
 Align = alBottom

end object HorizontalSplitter: TSplitter

 Width = 3
 Align = alLeft

end object BottomPanel: TPanel

 Height = 75
 Align = alBottom

end object LeftPanel: TPanel

 Width = 125
 Align = alLeft

end object MainPanel: TPanel

 Align = alClient

end </delphi>

<delphi> object VerticalSplitter: TPairSplitter

 Align = alClient
 SplitterType = pstVertical
 Position = 225
 Height = 300
 Width = 400
 object Pairsplitterside1: TPairSplitterIde
   object HorizontalSplitter: TPairSplitter
     Align = alClient
     Position = 125
     object Pairsplitterside3: TPairSplitterIde
       Width = 125
       object LeftPanel: TPanel
         Align = alClient
         Width = 125
       end
     end
     object Pairsplitterside4: TPairSplitterIde
       object MainPanel: TPanel
         Align = alClient
       end
     end
   end
 end
 object Pairsplitterside2: TPairSplitterIde
   object BottomPanel: TPanel
     Align = alClient
     Height = 75
   end
 end

end </delphi>

TCustomTreeView/TTreeView

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

Incomplete list, also update to include TCustomTreeView Mark functions and protected methods

  1. 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 :
    • tvoAllowMultiselect - enables multi node select mode, equivalent to enabling TCustomTreeView.MultiSelect in the D6 VCL
    • tvoAutoExpand - Auto Expand nodes, equivalent to enabling TCustomTreeView.AutoExpand
    • tvoAutoInsertMark - Update the Drag preview on mouse move.
    • tvoAutoItemHeight - Adjust the item heights automatically.
    • tvoHideSelection - Do not mark the selected item.
    • tvoHotTrack - use Hot Tracking, equivalent to enabling TCustomTreeview.HotTrack
    • tvoKeepCollapsedNodes - When shrinking/folding nodes, keep the child nodes
    • tvoReadOnly - make Treeview read only, equivalent to enabling TCustomTreeview.ReadOnly
    • tvoRightClickSelect - allow using Mouse Right Clicks to select nodes, equivalent to enabling TCustomTreeView.RightClickSelect
    • tvoRowSelect - allow selecting rows, equivalent to enabling TCustomTreeView.RowSelect
    • tvoShowButtons - show buttons, equivalent to enabling TCustomTreeView.ShowButtons
    • tvoShowLines - show node lines, equivalent to enabling TCustomTreeView.ShowLines
    • tvoShowRoot - show root note, equivalent to enabling TCustomTreeView.ShowRoot
    • tvoShowSeparators - show seperators
    • tvoToolTips - show tooltips for individual nodes
  2. The LCL provides additional properties:
    • TCustomTreeView.OnSelectionChange event
    • TCustomTreeView.DefaultItems, for the default number of Items
    • TCustomTreeView.ExpandSignType to determine sign used on expandable/collapsible nodes
  3. 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.

Messages / Events

The order and frequency of messages and events (OnShow, OnActivate, OnEnter, ...) differ from the VCL and depend on the 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).

Colaboradores originales y cambios

Esta página a sido convertidad desde la versión de la epikwiki.

See Also

Guía de conversión de código (desde Delphi y Kylix)

Compile With Delphi