Autor Beitrag
sibbe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

WIN XP Prof
D7 Prof
BeitragVerfasst: Sa 13.03.04 20:44 
servus!

ich hab folgendes problem: ich hab eine tchecklistbox, die zur laufzeit erstellt wird und deswegen auch variablen inhalt hat.
wie kann ich nun prüfen, ob ALLE Items "checked" sind, also angeklickt wurden?

thx im voraus

sibbe


Zuletzt bearbeitet von sibbe am Sa 13.03.04 21:12, insgesamt 1-mal bearbeitet
sibbe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

WIN XP Prof
D7 Prof
BeitragVerfasst: Sa 13.03.04 21:11 
so, bin von alleine draufgekommen (bin heute irgendwie nicht ganz herr meiner sinne... :( )
naja, falls es noch irgendwen interessiert, der code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.CH1ClickCheck(Sender: TObject);
var i,a: integer;
begin
a:=0;
for i:=0 to ch1.Items.Count-1 do begin
if not ch1.Checked[i] then exit;
inc(a);
if a= ch1.Items.Count then showmessage('funzt');
end;



so long
sibbe
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 14.03.04 12:32 
Na, in dem Fall kannst du auf die Variable "a" doch auch verzichten, denn wenn irgendein Eintrag nicht markiert (= checked) ist, dann stimmt deine Bedingung
Zitat:
ALLE Items

schon mal nicht, und deine Prozedur wird ohnehin durch "exit" verlassen. Fazit: es ist unerheblich, ob du die Anzahl zählst. Zumindest in dem Fall. ;)
sibbe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

WIN XP Prof
D7 Prof
BeitragVerfasst: So 14.03.04 15:32 
jo, hast natürlich recht.

war gestern einfach nich ganz klar im kopf, weiss auch nich warum :roll:

sibbe :)