Autor Beitrag
motion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: So 26.11.06 12:07 
Wenn ich bei einer Tcheckbox eine Zuweisung an die Eigenschaft .checked mache, wird immer das OnClick Ereignis aufgerufen.
Das ist störend, wenn ich das zur Laufzeit zuweise und dort andere Reaktionen möchte, als wenn der Anwender wirklich die Checkbox ändert (durch click, Space-Taste etc.; dann soll eine Sicherheitsabfrage [Wollen Sie wirklich ...?]).
Gibt es dafür noch eine andere Möglichkeit (Event), dass
nur feuert, wenn der Anwender den Status ändert (Click, space-Taste) und NICHT feuert bei einfachen Variablenzuweisungen?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 26.11.06 12:16 
Soweit ich weiß, hilft bei sowas nur, das OnClick-Event vorher auf Nil zu setzen. Also
ausblenden Delphi-Quelltext
1:
2:
3:
CheckBox1.OnClick := NIL;
CheckBox1.Checked := True;
CheckBox1.OnClick := CheckBox1Click;

_________________
We are, we were and will not be.
motion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: So 26.11.06 12:42 
Aaah, ja das ist eine gute Idee!
Da ich mit einer eigenen Ableitung der Tcheckbox arbeite, kann ich ja eine neue Methode "SetCheckedStatus" definieren, welche genau diese Funktionalität einführt.

Danke für den schnellen Tip ...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 26.11.06 13:32 
Hallo,

ich hatte dort mal die Möglichkeiten zu dem Thema aufgelistet,
denke das das auch für Dich interessant sein könnte:
forum.dsdt.info: Checked ändern, ohne das OnClick Ereignis auszuführen

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )