Autor Beitrag
Krischa
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118

Windows 7 64 Bit
Delphi 2007
BeitragVerfasst: Mi 27.05.09 09:20 
Hi,
ich möchte einen Befehleausführen wenn meine Checklisbox Items hat und dann auch noch mindestens 1 Checked=true hat. Bisher habe ich nur Abgefragt ob Items drin sind und muss nun die Bedingung erwetiern. Aber wie? Jemand eine Idee?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if (checklistbox1.Items.Count<>0) AND (.....) then
begin
 ....Befehle
end;
nabbl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 51

Win XP Home
Delphi 7 PE
BeitragVerfasst: Mi 27.05.09 09:23 
Gibt es vielleicht sowas wie Checklistbox.Items[i].Checked ?
Krischa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118

Windows 7 64 Bit
Delphi 2007
BeitragVerfasst: Mi 27.05.09 09:27 
Sowas gibt es ja leider nicht :cry:
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Mi 27.05.09 09:32 
Du brauchst etwas Handarbeit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Function TForm2.IsItemChecked(lb : TCheckListBox) : Boolean;
var i : integer;
begin
  result := false;
  i := 0;
  while (i <= lb.Items.count - 1) and not result do
  begin
    result := lb.Checked[i];
    inc(i);
  end;

end;

{...}
if (checklistbox1.Items.Count<>0) AND (IsItemChecked(checklistbox1)) then
begin
 ....Befehle
end;

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)
nabbl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 51

Win XP Home
Delphi 7 PE
BeitragVerfasst: Mi 27.05.09 09:33 
Sorry, dann kann ich dir mangels Delphi2007 nicht weiterhelfen :(
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mi 27.05.09 09:38 
naja also wie wärs mit clbx.checked[i] ?
Edit: Sorry noch früh am Morgen sehe gerade das Nersegatt schon quelltext dazu geliefert hat.
Der sollte deinen vorstellungen entsprechen.
Krischa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118

Windows 7 64 Bit
Delphi 2007
BeitragVerfasst: Mi 27.05.09 09:55 
Danke für die Hilfe und der Quelltext funktioniert :D