RxFPC:RxDBGrid - fix copy selected row to cliboard. tnx rellai2

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5358 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2016-11-17 06:48:21 +00:00
parent cec7326c1c
commit 44f0250efa
5 changed files with 103 additions and 22 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="10"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
@ -13,9 +13,6 @@
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="9"/>
<Version Value="10"/>
<BuildModes Active="Default"/>
<Units Count="11">
<Unit0>
@ -19,8 +19,8 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="48"/>
<CursorPos X="9" Y="73"/>
<TopLine Value="3"/>
<CursorPos X="6" Y="84"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -53,14 +53,15 @@
</Unit4>
<Unit5>
<Filename Value="../../rxdbgrid.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="4701"/>
<CursorPos Y="4725"/>
<EditorIndex Value="1"/>
<TopLine Value="5397"/>
<CursorPos X="54" Y="5421"/>
<UsageCount Value="15"/>
<Bookmarks Count="2">
<Item0 X="14" Y="822" ID="1"/>
<Item1 X="48" Y="622" ID="2"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="../../../fpspreadsheet/fpsstrings.pas"/>
@ -103,7 +104,7 @@
<UsageCount Value="10"/>
</Unit10>
</Units>
<JumpHistory Count="3" HistoryIndex="2">
<JumpHistory Count="9" HistoryIndex="8">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="73" TopLine="57"/>
@ -116,6 +117,30 @@
<Filename Value="unit1.pas"/>
<Caret Line="78" TopLine="57"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="84" Column="6" TopLine="3"/>
</Position4>
<Position5>
<Filename Value="../../rxdbgrid.pas"/>
<Caret Line="117" Column="37" TopLine="100"/>
</Position5>
<Position6>
<Filename Value="../../rxdbgrid.pas"/>
<Caret Line="990" Column="61" TopLine="959"/>
</Position6>
<Position7>
<Filename Value="../../rxdbgrid.pas"/>
<Caret Line="4542" Column="24" TopLine="4512"/>
</Position7>
<Position8>
<Filename Value="../../rxdbgrid.pas"/>
<Caret Line="5445" Column="9" TopLine="5409"/>
</Position8>
<Position9>
<Filename Value="../../rxdbgrid.pas"/>
<Caret Line="5425" Column="15" TopLine="5407"/>
</Position9>
</JumpHistory>
</ProjectSession>
<Debugging>

View File

@ -12,9 +12,9 @@ object Form1: TForm1
LCLVersion = '1.7'
object RxDBGrid1: TRxDBGrid
Left = 0
Height = 463
Height = 450
Hint = 'Список данных'
Top = 64
Top = 77
Width = 746
ColumnDefValues.BlobText = '(blob)'
TitleButtons = True
@ -28,8 +28,11 @@ object Form1: TForm1
Width = 90
FieldName = 'CODE'
EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(Все значения)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footers = <>
@ -42,8 +45,11 @@ object Form1: TForm1
Width = 350
FieldName = 'NAME'
EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(Все значения)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footers = <
@ -70,8 +76,11 @@ object Form1: TForm1
Width = 120
FieldName = 'PRICE'
EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(Все значения)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footer.Alignment = taRightJustify
@ -154,6 +163,8 @@ object Form1: TForm1
FooterOptions.Color = clYellow
FooterOptions.RowCount = 3
FooterOptions.DrawFullLine = False
SearchOptions.QuickSearchOptions = [loCaseInsensitive, loPartialKey]
SearchOptions.FromStart = False
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgFooterRows, rdgAllowToolMenu]
FooterColor = clYellow
FooterRowCount = 3
@ -165,28 +176,28 @@ object Form1: TForm1
SelectedColor = clHighlight
GridLineStyle = psSolid
DataSource = DataSource1
Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColumnMove, dgColLines, dgRowLines, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit, dgHeaderPushedLook]
Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColumnMove, dgColLines, dgRowLines, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit, dgMultiselect, dgHeaderPushedLook]
ParentColor = False
TabOrder = 0
TitleStyle = tsNative
end
object Panel1: TPanel
Left = 0
Height = 64
Height = 77
Top = 0
Width = 746
Align = alTop
AutoSize = True
ClientHeight = 64
ClientHeight = 77
ClientWidth = 746
TabOrder = 1
object Label1: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
Left = 7
Height = 17
Height = 20
Top = 7
Width = 132
Width = 145
BorderSpacing.Around = 6
Caption = 'SpeadSheet file name '
ParentColor = False
@ -196,9 +207,9 @@ object Form1: TForm1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
Left = 13
Height = 27
Height = 37
Hint = 'Укажите имя файла'
Top = 30
Top = 33
Width = 275
FilterIndex = 0
HideDirectories = False
@ -216,7 +227,7 @@ object Form1: TForm1
Left = 294
Height = 33
Hint = 'Начать выгрузку'
Top = 27
Top = 35
Width = 87
Caption = 'Export data'
OnClick = Button1Click

View File

@ -5402,10 +5402,58 @@ procedure TRxDBGrid.OnCopyCellValue(Sender: TObject);
var
P:TBookMark;
S:string;
i, k:integer;
i, k, j:integer;
begin
if DatalinkActive then
begin
if (dgMultiselect in Options) and (SelectedRows.Count>1) then
begin
S:='';
DataSource.DataSet.DisableControls;
{$IFDEF NoAutomatedBookmark}
P:=DataSource.DataSet.GetBookmark;
{$ELSE}
P:=DataSource.DataSet.Bookmark;
{$ENDIF}
try
for j:=0 to SelectedRows.Count-1 do
begin
DataSource.DataSet.Bookmark:=SelectedRows[j];
if S<>'' then
S:=S+LineEnding;
K:=0;
for i:=0 to Columns.Count-1 do
begin
if Assigned(Columns[i].Field) then
begin
if K<>0 then
S:=S+#9;
S:=S+Columns[i].Field.DisplayText;
inc(K);
end;
end;
end;
finally
{$IFDEF NoAutomatedBookmark}
DataSource.DataSet.GotoBookmark(P);
DataSource.DataSet.FreeBookmark(P);
{$ELSE}
DataSource.DataSet.Bookmark:=P;
{$ENDIF}
DataSource.DataSet.EnableControls;
end;
Invalidate;
if S<>'' then
begin
try
Clipboard.Open;
Clipboard.AsText:=S;
finally
Clipboard.Close;
end;
end;
end
else
if (dgMultiselect in Options) and (SelectedRows.Count>1) then
begin
S:='';