Autor Beitrag
mtm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Windows 10 Pro 64 Bit
Delphi XE 6
BeitragVerfasst: Mi 15.10.14 17:32 
Hallo zusammen,

ich habe ein kleines Problem. Ich bin dabei eine eigene Komponente zu erstellen (eine Art Schalter mit LED). Dieser Komponente will ich auch Actions zuweisen können. Das funktioniert auch ohne größere Probleme. Die Aktion wird beim anclicken der Komponente ausgeführt. Nun möchte ich aber, daß, wenn sich zur Laufzeit an der Action etwas ändert (Caption, Checked, Enabled), diese Änderung auch in der zugewiesenen Komponente sichtbar werden. Wie kriege ich das hin, daß die Komponente merkt, daß sich in der Action etwas geändert hat.

Ich habe schon gesucht und sogar 2 ähnliche Fragen (bzw. gleiche) gefunden, dort ist aber keine Antwort gegeben worden. Ich wollte dieses Problem deswegen noch einmal in Erinnerung bringen.

bis dene und danke im Voraus
mtm

siehe : www.delphipraxis.net...onente-new-post.html
Blup
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 173
Erhaltene Danke: 43



BeitragVerfasst: Fr 17.10.14 09:43 
Einfach Invalidate aufrufen.
mtm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Windows 10 Pro 64 Bit
Delphi XE 6
BeitragVerfasst: Fr 17.10.14 16:43 
Das ist mir schon klar.
Das Problem liegt aber eher in der Frage, wie die eigene Komponente mitbekommt, wenn in der zugewiesenen Action etwas geändert wurde.
Blup
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 173
Erhaltene Danke: 43



BeitragVerfasst: Mo 20.10.14 09:56 
Dafür implementiert man normalerweise für die betreffenden Property Set-Methoden.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
TMyLED = class(...)
private
  FChecked: Boolean;
  procedure SetChecked(AValue: Boolean);
published
  property Checked: Boolean read FChecked write SetChecked;
end;

procedure TMyLED.SetChecked(AValue: Boolean);
begin
  FChecked := AValue;
  Invalidate;
end;


Die Methode "GetActionLinkClass" kann überschrieben werden, wenn man ganz speziell auf Änderungen der Action reagieren will.