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

View File

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

View File

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

View File

@ -5402,10 +5402,58 @@ procedure TRxDBGrid.OnCopyCellValue(Sender: TObject);
var var
P:TBookMark; P:TBookMark;
S:string; S:string;
i, k:integer; i, k, j:integer;
begin begin
if DatalinkActive then if DatalinkActive then
begin 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 if (dgMultiselect in Options) and (SelectedRows.Count>1) then
begin begin
S:=''; S:='';