AK
Size: a a a
AK
DB
DB
AS
AS
AK
DB
AK
procedure TfmRecipes.sgRecipesKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
i,lcnt:integer;
ar:array of integer;
begin
if (Key=VK_DELETE) then
begin
// 1 - calc lines amount
lcnt:=0;
ar:=nil;
for i:=sgRecipes.RowCount-1 downto 1 do
if sgRecipes.IsCellSelected[colTitle,i] then
inc(lcnt);
SetLength(ar,lcnt);
// 2 - create numbers list
lcnt:=0;
for i:=sgRecipes.RowCount-1 downto 1 do
begin
if sgRecipes.IsCellSelected[colTitle,i] then
begin
ar[lcnt]:=i;
inc(lcnt);
end;
end;
// 3 - delete rows
for i:=0 to lcnt-1 do
sgRecipes.DeleteRow(ar[i]);
SetLength(ar,0);
end;
end;
DB
AK
DB
AS
procedure TfmRecipes.sgRecipesKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
i,lcnt:integer;
ar:array of integer;
begin
if (Key=VK_DELETE) then
begin
// 1 - calc lines amount
lcnt:=0;
ar:=nil;
for i:=sgRecipes.RowCount-1 downto 1 do
if sgRecipes.IsCellSelected[colTitle,i] then
inc(lcnt);
SetLength(ar,lcnt);
// 2 - create numbers list
lcnt:=0;
for i:=sgRecipes.RowCount-1 downto 1 do
begin
if sgRecipes.IsCellSelected[colTitle,i] then
begin
ar[lcnt]:=i;
inc(lcnt);
end;
end;
// 3 - delete rows
for i:=0 to lcnt-1 do
sgRecipes.DeleteRow(ar[i]);
SetLength(ar,0);
end;
end;
AK
DB
AK
DB
AK
DB
AK
AK