Einzelnen Beitrag anzeigen

Benutzerbild von littleDave
littleDave

Registriert seit: 27. Apr 2006
Ort: München
556 Beiträge
 
Delphi 7 Professional
 
#7

Re: TListView ind das selektieren

  Alt 16. Jul 2008, 17:12
Zitat von marius0702:
Nein bei allen checkbox componenten bei onclick oder onchange.
Die ListView-CheckBoxes sind aber keine TCheckBox-Komponenten ... . In der ListView geht auch OnChange.

[OT]
Zitat von marius0702:
Delphi-Quellcode:
procedure TForm1.CheckBoxMultiClick(Sender: TObject);
begin
  Case (Sender as TCheckBox).Tag of
    0: if CheckBox1.Checked then Listview1.items[0]:='Bla Bla';
    1: if CheckBox2.Checked then ...;
    2: if CheckBox3.Checked then ...;
    3: if CheckBox4.Checked then ...;
    4: if CheckBox5.Checked then ...;
    5: if CheckBox6.Checked then ...;
    6: if CheckBox7.Checked then ...;
    7: if CheckBox8.Checked then ...;
  end;
end;
Warum der gigantische Umweg
Delphi-Quellcode:
procedure TForm1.CheckBoxMultiClick(Sender: TObject);
var cb: TCheckBox;
begin
  if not (Sender is TCheckBox) then
     raise Exception.Create('Ich bin ein Fehler');
  cb := TCheckBox(Sender);
  ListView1.Items[cb.Tag].Caption := BoolToStr(cb.Checked), True);
end;
[/OT]
Jabber: littleDave@jabber.org
in case of 1 is 0 do external raise while in public class of object array else repeat until 1 is 0
  Mit Zitat antworten Zitat