View Issue Details

IDProjectCategoryView StatusLast Update
0006540JEDI VCL00 JVCL Componentspublic2019-05-02 08:32
ReporterCDamettoAssigned Tojfudickar 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.48 
Target VersionFixed in Version 
Summary0006540: Horizontal reset of dbgrid scrollbar by moving a column
DescriptionIn a DBGrid with dgRowSelect in Options, TitleButton = True and TitleButtonAllowMove = True, whether the horizontal scrollbar is present and you move a column at the right end, the grid is repositioned to the start left.
Additional InformationThis is my correction, in the file JvDBGrid.pas near the bottom of the MouseUp procedure...
Original block:

  if (Button = mbLeft) and (FGridState = gsColSizing) then
  begin
    ALeftCol := LeftCol;
    inherited MouseUp(Button, Shift, X, Y);
    if (dgRowSelect in Options) then
      LeftCol := ALeftCol;
    if Assigned(OnColumnResized) then
      OnColumnResized(Self, FSizingIndex + Byte(not (dgIndicator in Options)) - 1,
        ColWidths[FSizingIndex]);
  end
  else
    inherited MouseUp(Button, Shift, X, Y);
  DoAutoSizeColumns;


I just developed the penultimate row:

  if (Button = mbLeft) and (FGridState = gsColSizing) then
  begin
    ALeftCol := LeftCol;
    inherited MouseUp(Button, Shift, X, Y);
    if (dgRowSelect in Options) then
      LeftCol := ALeftCol;
    if Assigned(OnColumnResized) then
      OnColumnResized(Self, FSizingIndex + Byte(not (dgIndicator in Options)) - 1,
        ColWidths[FSizingIndex]);
  end
  else
  begin
    SI.cbSize := SizeOf(SI); //
    SI.fMask := SIF_POS; // Store scrollbar position
    GetScrollInfo(Handle, SB_HORZ, SI); //
    LockWindowUpdate(Handle);
    try
      inherited MouseUp(Button, Shift, X, Y);
      Perform(WM_HSCROLL, MakeWParam(SB_THUMBPOSITION, SI.nPos), 0); //Repos
    finally
      LockWindowUpdate(0);
    end;
  end;
  DoAutoSizeColumns;
TagsNo tags attached.

Activities

CDametto

2016-12-28 16:35

reporter   ~0021407

The variable SI is declared locally in the procedure as SI: TScrollInfo;

obones

2018-07-18 15:52

administrator   ~0021521

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.

2019-01-25 10:49

 

Demo.zip (6,546 bytes)

CDametto

2019-01-25 10:53

reporter   ~0021601

The issue is still present in jvcl 3.50 with Delphi 10.3 rio

2019-01-25 12:07

 

Demo_corrected.zip (54,752 bytes)

mh

2019-04-25 22:14

reporter   ~0021741

Made this pull request out of your proposed fix:
https://github.com/project-jedi/jvcl/pull/91

mh

2019-05-01 13:51

reporter   ~0021787

Pull request revoked and replaced by this improved one (better variable naming and commenting):
https://github.com/project-jedi/jvcl/pull/116

jfudickar

2019-05-02 08:32

developer   ~0021788

Fixed in Repository

Issue History

Date Modified Username Field Change
2016-12-09 14:24 CDametto New Issue
2016-12-28 16:35 CDametto Note Added: 0021407
2018-07-18 15:52 obones Note Added: 0021521
2018-07-18 15:52 obones Status new => feedback
2019-01-25 10:49 CDametto File Added: Demo.zip
2019-01-25 10:53 CDametto Note Added: 0021601
2019-01-25 12:07 CDametto File Added: Demo_corrected.zip
2019-04-25 22:14 mh Note Added: 0021741
2019-05-01 13:51 mh Note Added: 0021787
2019-05-02 08:32 jfudickar Note Added: 0021788
2019-05-02 08:32 jfudickar Status feedback => resolved
2019-05-02 08:32 jfudickar Resolution open => fixed
2019-05-02 08:32 jfudickar Assigned To => jfudickar