unit FeldEditor;
interface
uses
Windows, Classes, Graphics, Forms, Controls, Buttons, DesignIntf,
DesignWindows, StdCtrls, ComCtrls, DesignEditors, DataBaseControls, SysUtils;
type
TFeldEditorDlg =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button3Click(Sender: TObject);
private
FFelder : TFeldListe;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
procedure FormCreate(Sender: TObject);
property EditorFelder : TFeldListe
read FFelder
write FFelder;
end;
TFeldProperty =
class(TClassProperty)
public
procedure Edit;
override;
function GetAttributes: TPropertyAttributes;
override;
end;
TFeldEditor =
class(TDefaultEditor)
protected
procedure EditProperty(
const PropertyEditor: IProperty;
var Continue: Boolean);
override;
public
procedure ExecuteVerb(
Index: Integer);
override;
function GetVerb(
Index: Integer):
string;
override;
function GetVerbCount: Integer;
override;
end;
procedure Register;
implementation
{$R *.dfm}
{ TFeldProperty }
procedure TFeldProperty.Edit;
var
Felder: TFeldListe;
FeldEditor: TFeldEditorDlg;
begin
Felder := TFeldListe(GetOrdValue);
FeldEditor := TFeldEditorDlg.Create(Application);
try
FeldEditor.FFelder := Felder;
FeldEditor.ShowModal;
finally
FeldEditor.Free;
end;
end;
function TFeldProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog, paSubProperties];
end;
{ TFeldEditor - Verbindungen/Objektinspektor }
procedure TFeldEditor.EditProperty(
const PropertyEditor: IProperty;
var Continue: Boolean);
var
PropName:
string;
begin
PropName := PropertyEditor.GetName;
if (CompareText(PropName, '
Felder') = 0)
then
begin
PropertyEditor.Edit;
Continue := False;
end;
end;
function TFeldEditor.GetVerb(
Index: Integer):
string;
begin
if Index = 0
then
Result := '
Felder'
else Result := '
';
end;
function TFeldEditor.GetVerbCount: Integer;
begin
Result := 1;
end;
procedure TFeldEditor.ExecuteVerb(
Index: Integer);
begin
if Index = 0
then Edit;
end;
{ Sonnstige }
procedure Register;
begin
RegisterComponents('
DataBaseControls', [TDataBase]);
RegisterComponentEditor(TDataBase, TFeldEditor);
RegisterPropertyEditor(TypeInfo(TFeldliste),
nil, '
', TFeldProperty);
end;
{ TFeldEditorDlg - Formular }
procedure TFeldEditorDlg.FormCreate(Sender: TObject);
begin
FFelder := TFeldListe.Create;
end;
procedure TFeldEditorDlg.Button3Click(Sender: TObject);
begin
ffelder.Feld[0].id := 0;
end;
end.