MadDoom Cheater
Reputation: 0
Joined: 27 Dec 2006 Posts: 38
|
Posted: Wed Jul 11, 2007 5:13 am Post subject: property in delphi |
|
|
ok, i know that i can add a new property to some class, but how i do it?
here is the code that i wrote: | Code: | unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Edit1: TEdit;
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TCompass = class(TControl)
private
FHeading: string;
procedure SetHeading(Value: string);
published
property Heading: string read FHeading write SetHeading;
end;
var
Form2: TForm2;
implementation
procedure TCompass.SetHeading(Value: string);
begin
if FHeading <> Value then
begin
FHeading := value;
Repaint; // update user interface to reflect new value
end;
end;
{$R *.dfm}
procedure TForm2.Edit1Change(Sender: TObject);
var s,l:TCompass;
begin
s.heading:='7';
edit1.Text:=s.fheading;
end;
end. |
y cant i change the property?!?!
|
|