View Issue Details

IDProjectCategoryView StatusLast Update
0006678JEDI VCL00 JVCL Componentspublic2020-08-10 08:36
ReporterMistralAssigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status acknowledgedResolutionopen 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0006678: TJvDBGrid raise EInvalidOperation double clicking on it
DescriptionWith the GIT update 79f2c24fd8b978626e08cc2aed1b6fc7f997f86e on 5/5/2019 someone introduced changes on mouseup handling in the TJvDBGrid component.

With this changes I'm getting strange EInvalidOperation handling the grid dblclick event. I've reproduced a simple case (attached):

1. a main form with a button
2. clicking the main form button is opened a form with the grid and data
3. dblclick on a row (simulating something like a record selection that close the form) and the program raise the exception
Additional InformationTo remove the problem I've to revert back the changes to previous version:

procedure TJvDBGrid.MouseUp(Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
var
  Cell: TGridCoord;
  ACol: Longint;
  DoClick: Boolean;
  ALeftCol: Integer;
  OriginalScrollInfo: TScrollInfo;
begin
  Cell := MouseCoord(X, Y);
  if FTracking and (FPressedCol <> nil) then
  begin
    DoClick := PtInRect(Rect(0, 0, ClientWidth, ClientHeight), {Types.} Point(X, Y)) and
      (Cell.Y < TitleOffset) and
      (FPressedCol = GetMasterColumn(Cell.X, Cell.Y));
    StopTracking;
    if DoClick then
    begin
      ACol := Cell.X;
      if dgIndicator in Options then
        Dec(ACol, IndicatorOffset);
      if (DataLink <> nil) and DataLink.Active and (ACol >= 0) and
        (ACol < Columns.Count) then
        DoTitleClick(FPressedCol.Index, FPressedCol.Field);
    end;
  end
  else
  if FSwapButtons then
  begin
    StopTracking;
    FSwapButtons := False;
    MouseCapture := False;
    if Button = mbRight then
      Button := mbLeft;
  end;
  if (Button = mbLeft) and (FGridState = gsColSizing) and
    (FSizingIndex + Byte(not (dgIndicator in Options)) <= FixedCols) then
  begin
    ColWidths[FSizingIndex] := GetMinColWidth(X - FSizingOfs - CellRect(FSizingIndex, 0).Left);
    FGridState := gsNormal;
  end;

  if FTitleArrowDown and (Button = mbLeft) then
  begin
    FTitleArrowDown := False;
    if FTitleArrow and (dgTitles in Options) and (dgIndicator in Options) and
       (Cell.X = 0) and (Cell.Y = 0) and (Columns.Count > 0) then
      ShowSelectColumnClick; // Selection of columns
  end;

  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
// OriginalScrollInfo.cbSize := SizeOf(OriginalScrollInfo);
// OriginalScrollInfo.fMask := SIF_POS;
// // Store scrollbar position
// GetScrollInfo(Handle, SB_HORZ, OriginalScrollInfo); //
// LockWindowUpdate(Handle);
// try
      inherited MouseUp(Button, Shift, X, Y);
// Perform(WM_HSCROLL, MakeWParam(SB_THUMBPOSITION, OriginalScrollInfo.nPos), 0); //Repos
// finally
// LockWindowUpdate(0);
// end;
  end;
  DoAutoSizeColumns;

  { XP Theming }
  {$IFNDEF COMPILER14_UP}
  {$IFDEF JVCLThemesEnabled}
  if UseXPThemes and StyleServices.Enabled then
  begin
    FPaintInfo.ColSizing := False;
    FPaintInfo.ColMoving := False;
    FPaintInfo.ColPressedIdx := -1;
    Invalidate;
  end;
  {$ENDIF JVCLThemesEnabled}
  {$ENDIF ~COMPILER14_UP}
end;
TagsNo tags attached.

Activities

2019-05-08 15:43

 

TestDBGrid.zip (85,803 bytes)

mh

2019-05-12 13:52

reporter   ~0021825

I tried to reproduce the crash you saw by running your test application in Rio Update 1 and I cannot reproduce it. In my case double clicking on a row just closes the window.

So what's the difference between our systems:
- Windows 10 x64 in a VM Ware VM
- Delphi 10.3 Rio Update 1
- JCL and JVCL installed from a forked of the original Git repository,
  but that fork kept in sync with the original JEDI repository

Does anybody else see the crash?

Mistral

2019-05-13 09:59

reporter   ~0021833

My system:
- Windows 10 x64 (real machine)
- Delphi 10.2.3 Tokyo
- JCL and JVCL installed from original Git repository

Mistral

2020-06-26 08:25

reporter   ~0021946

still present in latest git repository commit (070ff4b1be5f4c9a39b00862c0fb5e6a345395e0)

now testing with Delphi 10.4 Sydney

I've to patch it manually at every update

mh

2020-08-09 10:40

reporter   ~0021948

These questions remain:
1. what was the change which causes you trouble was intended to fix/change?
2. Why does it crash on your computer but not on mine? Maybe we have different screen resolution or scaling?
    I have 1920x1080 with 100% scaling.

Mistral

2020-08-10 08:36

reporter   ~0021954

1.I have no idea what anyone who changed that piece of code wanted to solve. Without that change the component works pretty good for me...

2. It crashes on every computer I've tested it no matter of resolution scaling etc etc. I've distributed a release of my software with that issue to hundreds of computers and all of them had the problem. I don't know why it doesn't crash on your computer.... :(

Issue History

Date Modified Username Field Change
2019-05-08 15:43 Mistral New Issue
2019-05-08 15:43 Mistral File Added: TestDBGrid.zip
2019-05-12 13:52 mh Note Added: 0021825
2019-05-13 09:59 Mistral Note Added: 0021833
2020-05-18 22:32 obones Status new => acknowledged
2020-06-26 08:25 Mistral Note Added: 0021946
2020-08-09 10:40 mh Note Added: 0021948
2020-08-10 08:36 Mistral Note Added: 0021954