procedure TForm1.GetSelectedCells;
{GRIDRECT DECLARATION...
TGridRect = record
case Integer of
0: (Left, Top, Right, Bottom: Longint);
1: (TopLeft, BottomRight: TGridCoord);
end;
}
var
cellSel: TGridRect;
selLeft, selTop, selRight, selBottom: Integer;
begin
cellSel := SG.Selection;
selLeft := cellSel.Left;
selTop := cellSel.Top;
selRight := cellSel.Right;
selBottom := cellSel.Bottom;
end;
procedure TForm1.GetSCButtonClick(Sender: TObject);
begin
GetSelectedCells;
end;
***************************************************
function GetSelectedString: String;
function TCWForm.GetSelectedString: String;
{return the string of characters that exists in cells selected by
the user (in a range of cells in the StringGrid) using cell
co-ordinates stored in selectedArray...}
var
selString: String;
col, row, dataEnd, i: Integer;
begin
{the selectedArray first index is 0...}
i := 0;
selString := '';
dataEnd := CWMain.GetSelDataEnd;
while (i <= dataEnd) do
begin
col := selectedArray[i];
Inc(i);
if (i > dataEnd) then break;
row := selectedArray[i];
selString := selString + (CWGrid.Cells[col, row]);
Inc(i);
end;
Result := selString;
end;