Einzelnen Beitrag anzeigen

Scorpion3000

Registriert seit: 18. Apr 2004
47 Beiträge
 
Delphi 7 Enterprise
 
#3

Re: Problem: Property auslesen

  Alt 30. Apr 2004, 07:35
Also:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DesignIntf, DesignEditors, StdCtrls;

type
  TConv = class(TForm)
    Editly: TEdit;
    Button1: TButton;
  private
    Label1: TLabeL;
  end;

  TNewComp = class(TComponent)
  public
     FCando: boolean;
     Fcaption: string;
  published
     property Cando: boolean read FCando write FCando;
     property Caption: string read FCaption write FCaption;
  end;

  Editor = class(TPropertyEditor)
  public
     function GetAttributes: TPropertyAttributes; override;
     procedure Edit; override;
  end;

procedure Register;

implementation

{$R *.dfm}
procedure Editor.Edit;
var
  NewComp1: TNewComp;
begin
  with TConv.Create(Application) do
  try
    Button1.Caption:= NewComp1.Fcaption; {Hier möchte ich nun auf das Property von NewComp}
    ShowModal; {zugreifen}
  finally
    Free;
  end;
end;

function Editor.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

procedure Register;
begin
  RegisterComponents('Beispiele',[NewComp]);
  RegisterPropertyEditor(TypeInfo(boolean), nil, '', Editor);
end;
  Mit Zitat antworten Zitat