Autor Beitrag
lotus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19

XP MediaCenter
Delphi 2005 Personal
BeitragVerfasst: Mi 21.02.07 20:17 
Hallo!

Ich wollte bei meiner selbst erstellten Komponente eine TBrush, TPen & TFont property machen. Wenn man die Werte dann jedoch ändert, ist keine Änderung sichtbar.

Kann das daran liegen, dass man nie Brush, sondern immer nur z.B Brush.color ändert?
Was ist der Fehler?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
property Pen: TPen read FPen write SetPen;

procedure Tshapebutton.SetPen(Value:TPen);
  begin
  if Value<>FPen then
    begin
    FPen:=Value;
    self.Shape.Pen:=Value; //die Pen-änderung soll eigentlich im Shape sichtbar sein.
   end;
  end;


Könnt ihr helfen; hab auch nix per SuFu gefunden!
Danke im Voraus, lotus

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt

_________________
Das leben ist zu kostbar um es dem Schicksal zu überlassen! - Deus X Machina
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 21.02.07 20:24 
Das Problem ist, dass man meistens keinen neuen Pen zuweisen wird, sondern nur die Eigenschaften ändert. Ich würd eher sowas machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function GetPen:TPen;
begin
  result:=Shape.Pen;
end;

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
lotus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19

XP MediaCenter
Delphi 2005 Personal
BeitragVerfasst: Mi 21.02.07 22:22 
hmm..
aber das Shape ist nicht public, sondern private..da hat der benutzer doch gar keinen Zugriff

(Wenn ich dass richtig verstanden habe, dass ich statt "read FPen" "read GetPen" schreiben soll :? )

_________________
Das leben ist zu kostbar um es dem Schicksal zu überlassen! - Deus X Machina
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 22.02.07 14:33 
Deswegen wirds ja auch über das GetPen gekapselt (das muss dann auch zur Klasse gehören)

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
lotus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19

XP MediaCenter
Delphi 2005 Personal
BeitragVerfasst: Do 22.02.07 16:47 
:D

Vielen Dank, es funktioniert!

_________________
Das leben ist zu kostbar um es dem Schicksal zu überlassen! - Deus X Machina