Registriert seit: 26. Jan 2011
339 Beiträge
Delphi 12 Athens
|
AW: TListView - aktivieren einiger Checkboxen verhindern
26. Sep 2019, 13:57
In Delphi 5 das probieren:
Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
with ListView1.Items.Add do
Caption:='abcdefg';
end;
var ures1, ures2: Integer;
procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
var i: Integer;
begin
if Change=ctState then
begin
ures1:=SendMessage(ListView1.Handle, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK);
end;
end;
procedure TForm1.ListView1Change(Sender: TObject; Item: TListItem; Change: TItemChange);
var i: Integer;
begin
if Change=ctState then
begin
ures2:=SendMessage(ListView1.Handle, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK);
if ((ures1 and LVIS_STATEIMAGEMASK) shr 12) <> ((ures2 and LVIS_STATEIMAGEMASK) shr 12) then
if Item.Index=0 then
Item.Checked:=False;
end;
end;
|
|
Zitat
|