Skip to content

Commit

Permalink
Multiselection with Shift/Ctrl in checklist window
Browse files Browse the repository at this point in the history
If multiple items are selected, then right click menu options (select
all, none, invent) will work only on the selection.
  • Loading branch information
zilav authored and Sharlikran committed Oct 18, 2017
1 parent 6173232 commit c3466ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions FileSelectFrm.pas
Expand Up @@ -99,6 +99,7 @@ procedure TfrmFileSelect.edSearchChange(Sender: TObject);
procedure TfrmFileSelect.FormCreate(Sender: TObject);
begin
Font := Screen.IconFont;
CheckListBox1.MultiSelect := True;
end;

procedure TfrmFileSelect.FormKeyDown(Sender: TObject; var Key: Word;
Expand All @@ -124,7 +125,7 @@ procedure TfrmFileSelect.InvertSelection1Click(Sender: TObject);
CheckListBox1.Items.BeginUpdate;
try
for i := 0 to Pred(CheckListBox1.Items.Count) do
if CheckListBox1.ItemEnabled[i] then
if CheckListBox1.ItemEnabled[i] and ((CheckListBox1.SelCount < 2) or CheckListBox1.Selected[i]) then
CheckListBox1.Checked[i] := not CheckListBox1.Checked[i];
finally
CheckListBox1.Items.EndUpdate;
Expand All @@ -138,7 +139,7 @@ procedure TfrmFileSelect.SelectAll1Click(Sender: TObject);
CheckListBox1.Items.BeginUpdate;
try
for i := 0 to Pred(CheckListBox1.Items.Count) do
if CheckListBox1.ItemEnabled[i] then
if CheckListBox1.ItemEnabled[i] and ((CheckListBox1.SelCount < 2) or CheckListBox1.Selected[i]) then
CheckListBox1.Checked[i] := True;
finally
CheckListBox1.Items.EndUpdate;
Expand All @@ -152,7 +153,7 @@ procedure TfrmFileSelect.SelectNone1Click(Sender: TObject);
CheckListBox1.Items.BeginUpdate;
try
for i := 0 to Pred(CheckListBox1.Items.Count) do
if CheckListBox1.ItemEnabled[i] then
if CheckListBox1.ItemEnabled[i] and ((CheckListBox1.SelCount < 2) or CheckListBox1.Selected[i]) then
CheckListBox1.Checked[i] := False;
finally
CheckListBox1.Items.EndUpdate;
Expand Down

0 comments on commit c3466ce

Please sign in to comment.