procedure TMainForm.ListKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
i, Max,
NewIndex: Integer;
AList: TStringList;
function NoShift : Boolean; begin Result := Shift = []; end;
function WithAlt : Boolean; begin Result := Shift = [ssAlt]; end;
function WithCtrl : Boolean; begin Result := Shift = [ssCtrl]; end;
function WithShift: Boolean; begin Result := Shift = [ssShift]; end;
function IsCopyCombo: Boolean;
begin Result := (Key in [VK_C, VK_INSERT]) and WithCtrl; end;
function IsCutCombo: Boolean;
begin {Like IsCopyCombo} end;
function IsAndCanPaste: Boolean;
begin {Similar to the previous two} end;
procedure DeleteSelection;
{ Adjusts ItemIndex to keep it on the same or, if deleted, the next file.}
{Without var i: integer the compiler gives me:
fmain.pas(471,9) Error: Illegal counter variable
in the "for i := FileList.ItemIndex downto 0 do"}
var
i: Integer;
begin
NewIndex := FileList.ItemIndex;
for i := FileList.ItemIndex downto 0 do
if (FileList.Selected[i]) then
if i <= NewIndex then Dec(NewIndex);
FileList.DeleteSelected;
FileList.ItemIndex := NewIndex;
end;
procedure DoCopy;
begin { Same error with a "for i :=" loop } end;
procedure DoCutDelete;
begin { No loop her } end;
procedure DoPaste;
begin { "for i :=" loop, same error } end;
begin
{ main block with a case statement checking various key combos
some of which call the appropiate nested proc from those above}
end;