You've already forked lazarus-ccr
demos: improvement to property editors in advanced
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2560 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -9,8 +9,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
LCLIntf, delphicompat, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
LCLIntf, delphicompat, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||||
StdCtrls, VirtualTrees, ExtDlgs, Buttons, ExtCtrls, ComCtrls,
|
StdCtrls, VirtualTrees, Buttons, ExtCtrls, MaskEdit, LCLType, EditBtn;
|
||||||
MaskEdit, LCLType, EditBtn;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
// Describes the type of value a property tree node stores in its data property.
|
// Describes the type of value a property tree node stores in its data property.
|
||||||
@ -36,6 +35,9 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Our own edit link to implement several different node editors.
|
// Our own edit link to implement several different node editors.
|
||||||
|
|
||||||
|
{ TPropertyEditLink }
|
||||||
|
|
||||||
TPropertyEditLink = class(TInterfacedObject, IVTEditLink)
|
TPropertyEditLink = class(TInterfacedObject, IVTEditLink)
|
||||||
private
|
private
|
||||||
FEdit: TWinControl; // One of the property editor classes.
|
FEdit: TWinControl; // One of the property editor classes.
|
||||||
@ -43,6 +45,7 @@ type
|
|||||||
FNode: PVirtualNode; // The node being edited.
|
FNode: PVirtualNode; // The node being edited.
|
||||||
FColumn: Integer; // The column of the node being edited.
|
FColumn: Integer; // The column of the node being edited.
|
||||||
protected
|
protected
|
||||||
|
procedure EditExit(Sender: TObject);
|
||||||
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
public
|
public
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -201,12 +204,17 @@ uses
|
|||||||
destructor TPropertyEditLink.Destroy;
|
destructor TPropertyEditLink.Destroy;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FEdit.Free;
|
Application.ReleaseComponent(FEdit);
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure TPropertyEditLink.EditExit(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FTree.EndEditNode;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPropertyEditLink.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure TPropertyEditLink.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -252,7 +260,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TPropertyEditLink.BeginEdit: Boolean;
|
function TPropertyEditLink.BeginEdit: Boolean; stdcall;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
@ -262,7 +270,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TPropertyEditLink.CancelEdit: Boolean;
|
function TPropertyEditLink.CancelEdit: Boolean; stdcall;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
@ -271,7 +279,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TPropertyEditLink.EndEdit: Boolean;
|
function TPropertyEditLink.EndEdit: Boolean; stdcall;
|
||||||
|
|
||||||
var
|
var
|
||||||
Data: PPropertyData;
|
Data: PPropertyData;
|
||||||
@ -304,7 +312,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TPropertyEditLink.GetBounds: TRect;
|
function TPropertyEditLink.GetBounds: TRect; stdcall;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := FEdit.BoundsRect;
|
Result := FEdit.BoundsRect;
|
||||||
@ -312,7 +320,8 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TPropertyEditLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean;
|
function TPropertyEditLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode;
|
||||||
|
Column: TColumnIndex): Boolean; stdcall;
|
||||||
|
|
||||||
var
|
var
|
||||||
Data: PPropertyData;
|
Data: PPropertyData;
|
||||||
@ -336,7 +345,6 @@ begin
|
|||||||
Visible := False;
|
Visible := False;
|
||||||
Parent := Tree;
|
Parent := Tree;
|
||||||
Text := Data.Value;
|
Text := Data.Value;
|
||||||
OnKeyDown := EditKeyDown;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
vtPickString:
|
vtPickString:
|
||||||
@ -351,7 +359,6 @@ begin
|
|||||||
Items.Add('Standard');
|
Items.Add('Standard');
|
||||||
Items.Add('Additional');
|
Items.Add('Additional');
|
||||||
Items.Add('Win32');
|
Items.Add('Win32');
|
||||||
OnKeyDown := EditKeyDown;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
vtNumber:
|
vtNumber:
|
||||||
@ -363,7 +370,6 @@ begin
|
|||||||
Parent := Tree;
|
Parent := Tree;
|
||||||
EditMask := '9999';
|
EditMask := '9999';
|
||||||
Text := Data.Value;
|
Text := Data.Value;
|
||||||
OnKeyDown := EditKeyDown;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
vtPickNumber:
|
vtPickNumber:
|
||||||
@ -374,7 +380,6 @@ begin
|
|||||||
Visible := False;
|
Visible := False;
|
||||||
Parent := Tree;
|
Parent := Tree;
|
||||||
Text := Data.Value;
|
Text := Data.Value;
|
||||||
OnKeyDown := EditKeyDown;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
vtMemo:
|
vtMemo:
|
||||||
@ -388,7 +393,6 @@ begin
|
|||||||
Parent := Tree;
|
Parent := Tree;
|
||||||
Text := Data.Value;
|
Text := Data.Value;
|
||||||
Items.Add(Data.Value);
|
Items.Add(Data.Value);
|
||||||
OnKeyDown := EditKeyDown;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
vtDate:
|
vtDate:
|
||||||
@ -399,17 +403,21 @@ begin
|
|||||||
Visible := False;
|
Visible := False;
|
||||||
Parent := Tree;
|
Parent := Tree;
|
||||||
Date := StrToDate(Data.Value);
|
Date := StrToDate(Data.Value);
|
||||||
OnKeyDown := EditKeyDown;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
FEdit.OnKeyDown := EditKeyDown;
|
||||||
|
FEdit.OnExit := EditExit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TPropertyEditLink.ProcessMessage(var Message: TMessage);
|
procedure TPropertyEditLink.ProcessMessage(var Message: TMessage); stdcall;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FEdit.WindowProc(Message);
|
FEdit.WindowProc(Message);
|
||||||
@ -417,7 +425,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TPropertyEditLink.SetBounds(R: TRect);
|
procedure TPropertyEditLink.SetBounds(R: TRect); stdcall;
|
||||||
|
|
||||||
var
|
var
|
||||||
Dummy: Integer;
|
Dummy: Integer;
|
||||||
|
Reference in New Issue
Block a user