LCL, allow StringGrid to copy current select range in addition to whole grid

git-svn-id: trunk@23901 -
This commit is contained in:
jesus 2010-03-09 19:28:18 +00:00
parent 0374dc7a00
commit e41a4b5a78
2 changed files with 11 additions and 4 deletions

View File

@ -12507,7 +12507,11 @@ Segunda linea de texto</descr>
</element>
<element name="TCustomStringGrid.CopyToClipboard">
<short>
<var>CopyToClipboard</var> - copy the selected text to the clipboard</short>
<var>CopyToClipboard</var> - copy a range of cells to clipboard</short>
<descr>This method will copy a range of cells into the clipboard, the cells values are TAB separated.
The range is defined based on optional <var>AUseSelection</var> parameter which is false by default and which means the range is set to the whole grid, including fixed cols/rows. If <var>AUseSelection</var> is true, the range of cells is set to current <link id="TCustomGrid.Selection"/>
</descr>
</element>
<topic name="HowToUseGrids">
<short>How to use <var>Grids</var> including <var>StringGrids</var>, <var>DrawGrids</var> and <var>DbGrids</var>

View File

@ -1430,7 +1430,7 @@ type
procedure Clean(CleanOptions: TGridZoneSet); overload;
procedure Clean(aRect: TRect; CleanOptions: TGridZoneSet); overload;
procedure Clean(StartCol,StartRow,EndCol,EndRow: integer; CleanOptions: TGridZoneSet); overload;
procedure CopyToClipboard;
procedure CopyToClipboard(AUseSelection: boolean = false);
property Cells[ACol, ARow: Integer]: string read GetCells write SetCells;
property Cols[index: Integer]: TStrings read GetCols write SetCols;
property DefaultTextStyle;
@ -9086,9 +9086,12 @@ begin
EndUpdate;
end;
procedure TCustomStringGrid.CopyToClipboard;
procedure TCustomStringGrid.CopyToClipboard(AUseSelection: boolean = false);
begin
CopyCellRectToClipboard(Rect(0,0,ColCount-1,RowCount-1));
if AUseSelection then
doCopyToClipboard
else
CopyCellRectToClipboard(Rect(0,0,ColCount-1,RowCount-1));
end;