Files
Ansgar Becker 9c897a5881 Add component: VirtualTreeView 4.5.2
License: GNU Lesser Public License.

This version is checked in as downloaded from http://www.soft-gems.net/supplement/download.php?ID=35. No adjustments / fixes on the packages yet.

Instead of adding the files I could have just added an external SVN link to svn://www.soft-gems.net/library/VirtualTreeview . But the files in that repository have some unsolved issues which would lead to compiler errors if we use them without changes. Especially the D2007 package does not compile without changes. We would not be able to commit those changes unless we have write access to their repo. I contacted the author Mike Lischke and we agreed that we always will take care of using the latest sources. Later updates should not cause big problems if we don't make big changes to the original files.

TVirtualStringTree shall be a perfect replacement for our standard TListView and its descendent TSortListView.
2007-08-13 19:18:28 +00:00

71 lines
1.6 KiB
ObjectPascal

unit StrEditD4;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls, dsgnintf;
type
TStrEditDlg = class(TForm)
Bevel1: TBevel;
btnOk: TButton;
btnCancel: TButton;
Editor: TRichEdit;
StatusBar: TStatusBar;
procedure EditorChange(Sender: TObject);
procedure EditorKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
FModified: Boolean;
public
{ Public declarations }
end;
TStringListProperty = class(TClassProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
implementation
{$R *.DFM}
procedure TStrEditDlg.EditorChange(Sender: TObject);
begin
if Sender = Editor then
FModified := True;
StatusBar.SimpleText := Format ('%d lines.', [Editor.Lines.Count]);
end;
procedure TStrEditDlg.EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_ESCAPE then
ModalResult := mrCancel;
end;
{ TStringListProperty }
procedure TStringListProperty.Edit;
begin
with TStrEditDlg.Create(Application) do
try
Editor.Lines := TStrings(GetOrdValue);
EditorChange (nil);
FModified := False;
ActiveControl := Editor;
if ShowModal = mrOk then
SetOrdValue(LongInt(Editor.Lines));
finally
Free;
end;
end;
function TStringListProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [paDialog] - [paSubProperties];
end;
end.