Autor Beitrag
lkz633
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 136

WinXP, Suse Linux 8.2 (unter VMWare)
D7 Prof, K3 Prof
BeitragVerfasst: Mo 16.12.02 00:22 
Hallo,

I aendere in meinem Programm den Status einer Checkbox, dadurch wird automatisch das Ereigniss onclick aufgerufen. Wie kann ich dies elegant vermeiden ?

Es geht natürlich mit einer zusaetlichen globalen Variablen, doch dies gefaellt mir nicht. Gibt es einen anderen Weg ?

Danke für Hilfe
MFG lkz633
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Mo 16.12.02 01:40 
Wieso willst du das verhindern? Mir fällt jetzt echt kein Grund dafür ein...
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 16.12.02 10:32 
Hatte dieses "Problem" auch schon mal gehabt. Hab mir immer damit geholfen vor dem setzen der Checked Eigenschaft das OnClick-Event auf NIL zu setzen und anschließend wieder auf die Methode.

Verstehe das eigentlich auch nicht warum ein OnCLICK-Event dadurch ausgelöst wird. Besser wäre ein OnChange oder so. Na ja...

Gruß
TINO
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 16.12.02 10:53 
Man sollte sich in diesem Fall merken welches Ereignis es vor dem Zuweisen von Nil war. Ich mache es meistens so:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Edit1Change(Sender: TObject); 
var
  Change: TNotifyEvent;
begin
  Change := Edit1.OnChange;
  Edit1.OnChange := nil;

  ...

  Edit1.OnChange := Change;
end;
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 16.12.02 10:56 
Stimmt. So mache ich es auch! :wink:
lkz633 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 136

WinXP, Suse Linux 8.2 (unter VMWare)
D7 Prof, K3 Prof
BeitragVerfasst: Mo 16.12.02 11:17 
Hallo,

herzlichen Dank für die schnelle Antwort, genau sowas hab ich gesucht. Hab noch ein mini-Problem. Ich hab jetzt folgenden code:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var
    change: TNotifyEvent;
begin
  change:= checkboxclick;
  checkboxclick()= nil;
........
  checkboxclick():= change;


checkboxclick ist eine eigene function, da die checkboxen dynamisch erzeugt werden.
ausblenden Quelltext
1:
procedure Tfmain.checkboxclick(sender: tobject);					


Was muss ich denn jetzt im obigen code in die Klammern schreiben, bekomms nicht hin

Dank und Gruss
lkz633
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 16.12.02 11:28 
denke mal die werte die du an die andere Unit weiter geben willst??? :P

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
lkz633 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 136

WinXP, Suse Linux 8.2 (unter VMWare)
D7 Prof, K3 Prof
BeitragVerfasst: Mo 16.12.02 11:43 
Hi,

Ich will aber ja gerade keine Werte übergeben

Gruss lkz633
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 16.12.02 12:28 
lkz633 hat folgendes geschrieben:
Ich hab jetzt folgenden code:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var
    change: TNotifyEvent;
begin
  change:= checkboxclick;
  checkboxclick()= nil;
........
  checkboxclick():= change;

Schau Dir noch mal genau den Sourcecode von Popov an. :wink:

Gruß
TINO
lkz633 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 136

WinXP, Suse Linux 8.2 (unter VMWare)
D7 Prof, K3 Prof
BeitragVerfasst: Mo 16.12.02 12:56 
Hi,

hatte das Problem das ich nicht wusste, wie ich da dranjomme, da ich die Komp. dynamisch erzeuge. Findcomponent war des Rätsels Lösung

Danke für die Hilfe
lkz633
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 16.12.02 13:43 
Das Ganze machst du ohne Klammern.