TDBGrid.Option dgAnyButtonCanSelect not working properly
Original Reporter info from Mantis: emilt
-
Reporter name: Emil Totev
Original Reporter info from Mantis: emilt
- Reporter name: Emil Totev
Description:
When this option is set, right-click moves the selection as advertised in the documentation, but does not un-select what was selected with a left-click.
Steps to reproduce:
In my case I have also set Options dgMultiselect and dgRowSelect to true, and I observe the following behaviour:
Left click selects the clicked record and un-selects any other
First right-click selects the clicked record, but doesn't un-select the currently selected record (2 records selected)
Next rIght-clicks on different records select the clicked record and un-select the previously selected by right-click record. The record initially selected by left-click stays selected (again two records selected)
Additional information:
The following patch at around line 2825 in DBGrids.pas seems to fix the problem for me:
else begin
- if Button=mbLeft then
- ClearSelection(true)
+ if (Button=mbLeft) or (dgAnyButtonCanSelect in Options) then
+ ClearSelection(true)
// Select row before popupmenu
- else
if (Button=mbRight) and Assigned(PopupMenu) and not FSelectedRows.CurrentRowSelected then
ToggleSelectedRow;
doMoveToColumn;
end;
Mantis conversion info:
- Mantis ID: 37357
- OS: Windows
- OS Build: Windows 10 x64
- Platform: x64
- Monitored by: » emilt (Emil Totev)