LCL: Implemented TCustomCheckListBox.CheckAll (Delphi2010 compat). Starts to works when bug #19979 is fixed

git-svn-id: trunk@31974 -
This commit is contained in:
juha 2011-08-13 12:15:02 +00:00
parent 3338aa1034
commit 278845f007

View File

@ -70,6 +70,7 @@ type
constructor Create(AOwner: TComponent); override;
procedure MeasureItem(Index: Integer; var TheHeight: Integer); override;
procedure Toggle(AIndex: Integer);
procedure CheckAll(AState: TCheckBoxState; AllowGrayed: Boolean = True; AllowDisabled: Boolean = True);
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default False;
property Checked[AIndex: Integer]: Boolean read GetChecked write SetChecked;
@ -214,6 +215,17 @@ begin
State[AIndex] := NextStateMap[State[AIndex]][AllowGrayed];
end;
procedure TCustomCheckListBox.CheckAll(AState: TCheckBoxState;
AllowGrayed: Boolean; AllowDisabled: Boolean);
var
i: Integer;
begin
for i := 0 to Items.Count - 1 do begin
if (AllowGrayed or (State[i] <> cbGrayed)) and (AllowDisabled or ItemEnabled[i]) then
State[i] := AState;
end;
end;
procedure TCustomCheckListBox.DoChange(var Msg: TLMessage);
begin
//DebugLn(['TCustomCheckListBox.DoChange ',DbgSName(Self),' ',Msg.WParam]);