LCL: Grids: added dgCanSelectAnyButton to grid options so we can select row with right mouse click, now we are Delphi compatibile.Patch by Zoran Vucenovic. Issue #18115

git-svn-id: trunk@33070 -
This commit is contained in:
zeljko 2011-10-24 16:54:11 +00:00
parent d6f183e393
commit 4e9eda7a16
2 changed files with 14 additions and 5 deletions

View File

@ -66,8 +66,9 @@ type
dgHeaderHotTracking,
dgHeaderPushedLook,
dgPersistentMultiSelect,
dgAutoSizeColumns
dgAutoSizeColumns,
dgCanSelectAnyButton // Any mouse button (not just left)
// moves the selection to clicked cell
);
TDbGridOptions = set of TDbGridOption;
@ -1014,6 +1015,11 @@ begin
else
Exclude(OldOptions, goHeaderPushedLook);
if dgCanSelectAnyButton in FOptions then
Include(OldOptions, goCanSelectAnyButton)
else
Exclude(OldOptions, goCanSelectAnyButton);
if (dgIndicator in ChangedOptions) then begin
if (dgIndicator in FOptions) then
FixedCols := FixedCols + 1
@ -2226,7 +2232,7 @@ begin
exit;
end;
if button<>mbLeft then begin
if (button<>mbLeft) and not (dgCanSelectAnyButton in FOptions) then begin
doInherited;
exit;
end;

View File

@ -104,7 +104,9 @@ type
goHeaderPushedLook, // Header cells looks pushed when clicked
goSelectionActive, // Setting grid.Selection moves also cell cursor
goFixedColSizing, // Allow to resize fixed columns
goDontScrollPartCell // clicking partially visible cells will not scroll
goDontScrollPartCell, // clicking partially visible cells will not scroll
goCanSelectAnyButton // Not only left mouse button, but also right and
// middle buttons move selection to clicked cell
);
TGridOptions = set of TGridOption;
@ -5718,7 +5720,8 @@ var
begin
inherited MouseDown(Button, Shift, X, Y);
if (csDesigning in componentState) or not (ssLeft in Shift) then
if (csDesigning in componentState) or
not ((goCanSelectAnyButton in FOptions) or (ssLeft in Shift)) then
Exit;
{$IfDef dbgGrid} DebugLn('MouseDown INIT'); {$Endif}