View Issue Details

IDProjectCategoryView StatusLast Update
0006678JEDI VCL00 JVCL Componentspublic2019-09-16 10:43
ReporterMistralAssigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
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

2019-06-13 17:44

reporter   ~0021856

Just upgrade Delphi to 10.3.1 Rio

JCL to latest GIT commit aa770ea4545555d2b790ea5ae8db1bebcf926b35
JVCL to latest GIT commit 1273b5e3c7e843ff14682c49dec3c2ceb196fcd0

the problem still persist

mh

2019-09-14 11:39

reporter   ~0021887

Can you point out in which line the crash happens? Even if I cannot reproduce the issue on my setup we might do a theoretical analysis and find something?

Mistral

2019-09-16 10:43

reporter   ~0021892

I've commented the lines of code that raise the exception.

The problem is calling the "Perform(WM_HSCROLL...." and the way this message is maneged during the closing form operation.

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
2019-06-13 17:44 Mistral Note Added: 0021856
2019-09-14 11:39 mh Note Added: 0021887
2019-09-16 10:43 Mistral Note Added: 0021892