Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006542 [JEDI VCL] 00 JVCL Components minor always 2016-12-28 16:32 2019-03-06 09:45
Reporter CDametto View Status public  
Assigned To obones
Priority normal Resolution unable to reproduce Platform
Status resolved   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 3.48
  Target Version Product Build
Summary 0006542: Horizontal reset of dbgrid scrollbar at line click when no indicator
Description In a DBGrid with dgRowSelect=true and dgIndicator=false in Options, whether the horizontal scrollbar is present, if you are at right end and you click on a row, the grid is repositioned to the start left.
Steps To Reproduce
Additional Information This is my correction, in the file JvDBGrid.pas, in the middle of the MouseDown procedure...
Original block:

//-------------------------------------------------------------------------------
// Prevents the grid from going back to the first column when dgRowSelect is True
// Does not work if there's no indicator column
//-------------------------------------------------------------------------------
if (dgRowSelect in Options) and (Cell.Y >= TitleOffset) then
begin
  // Why do we always have to work around the VCL. If we use the original X the
  // Grid will scroll back to the first column. But if we don't use the original X
  // and goRowSizing is enabled, the user can start resizing rows in the wild.
  WasRowResizing := goRowSizing in TCustomGridAccess(Self).Options;
  try
    // Disable goRowSizing without all the code that SetOptions executes.
    TGridOptions(Pointer(@TCustomGridAccess(Self).Options)^) := TCustomGridAccess(Self).Options - [goRowSizing];
    inherited MouseDown(Button, Shift, 1, Y);
    InheritedCalled := True;
  finally
    if WasRowResizing then
      TGridOptions(Pointer(@TCustomGridAccess(Self).Options)^) := TCustomGridAccess(Self).Options + [goRowSizing];
  end;
end

I declared in the procedure var SI: TScrollInfo;
block with my correction:

//-------------------------------------------------------------------------------
// Prevents the grid from going back to the first column when dgRowSelect is True
// Does not work if there's no indicator column
//-------------------------------------------------------------------------------
if (dgRowSelect in Options) and (Cell.Y >= TitleOffset) then
begin
  // Why do we always have to work around the VCL. If we use the original X the
  // Grid will scroll back to the first column. But if we don't use the original X
  // and goRowSizing is enabled, the user can start resizing rows in the wild.
  WasRowResizing := goRowSizing in TCustomGridAccess(Self).Options;
  try
    // Disable goRowSizing without all the code that SetOptions executes.
    TGridOptions(Pointer(@TCustomGridAccess(Self).Options)^) := TCustomGridAccess(Self).Options - [goRowSizing];

    SI.cbSize := SizeOf(SI); //ADDED
    SI.fMask := SIF_POS; //ADDED
    GetScrollInfo(Handle, SB_HORZ, SI); //ADDED
    LockWindowUpdate(Handle); //ADDED
    try //ADDED
    
      inherited MouseDown(Button, Shift, 1, Y);
    
    Perform(WM_HSCROLL, MakeWParam(SB_THUMBPOSITION, SI.nPos), 0); //ADDED
    finally //ADDED
      LockWindowUpdate(0); //ADDED
    end; //ADDED

    InheritedCalled := True;
  finally
    if WasRowResizing then
      TGridOptions(Pointer(@TCustomGridAccess(Self).Options)^) := TCustomGridAccess(Self).Options + [goRowSizing];
  end;
end
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0021505)
obones (administrator)
2018-07-18 15:47

Could you check if the issue is still present in the latest GIT content? If yes, please provide the zipped sources of an application showing this.
(0021603)
CDametto (reporter)
2019-01-25 12:20

Now it seems to work. Thank you.

- Issue History
Date Modified Username Field Change
2016-12-28 16:32 CDametto New Issue
2018-07-18 15:47 obones Note Added: 0021505
2018-07-18 15:47 obones Status new => feedback
2019-01-25 12:20 CDametto Note Added: 0021603
2019-03-06 09:45 obones Status feedback => resolved
2019-03-06 09:45 obones Resolution open => unable to reproduce
2019-03-06 09:45 obones Assigned To => obones


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker