Autor Beitrag
20:30
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Sa 14.07.12 11:31 
Ich möchte eine Komponente um einen Wert erweitern.

Sowas wie: Image1.MeinWert (In meinem Fall ist dieser Wert ein einfacher Integer)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 14.07.12 11:37 
Das ist schön. Hast du auch eine Frage dazu? :gruebel:

Das Prinzip ist im Menü Komponente auf Neue Komponente zu gehen, die Basisklasse auszuwählen und die neue erzeugen zu lassen. (Du kannst den Quelltext natürlich auch manuell tippen.)

In dieser neuen Komponente kannst du dann die neue property unter published hinzufügen. (Und die Komponente kannst du dann wenn gewünscht installieren.)
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 14.07.12 11:47 
So könnte der Code der abgeleiteten Komponente aussehen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
type
  TMyImage = class(TImage)
  private
    FMyValue: Integer;
  published
    property MyValue: Integer read FMyValue write FMyValue;
  end;


Anfänger Tutorials:
www.delphi-treff.de/...en/objekthierarchie/
de.wikibooks.org/wik...mponentenentwicklung
pcnews.at/d/_pdf/n480090.pdf

Weiterführende Infos:
wiki.delphigl.com/in...mponentenentwicklung