Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
6678 00 JVCL Components major always 2019-05-08 15:43 2019-05-13 09:59
new Daily / GIT  
0006678: TJvDBGrid raise EInvalidOperation double clicking on it
With 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
To remove the problem I've to revert back the changes to previous version:

procedure TJvDBGrid.MouseUp(Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
  Cell: TGridCoord;
  ACol: Longint;
  DoClick: Boolean;
  ALeftCol: Integer;
  OriginalScrollInfo: TScrollInfo;
  Cell := MouseCoord(X, Y);
  if FTracking and (FPressedCol <> nil) then
    DoClick := PtInRect(Rect(0, 0, ClientWidth, ClientHeight), {Types.} Point(X, Y)) and
      (Cell.Y < TitleOffset) and
      (FPressedCol = GetMasterColumn(Cell.X, Cell.Y));
    if DoClick then
      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);
  if FSwapButtons then
    FSwapButtons := False;
    MouseCapture := False;
    if Button = mbRight then
      Button := mbLeft;
  if (Button = mbLeft) and (FGridState = gsColSizing) and
    (FSizingIndex + Byte(not (dgIndicator in Options)) <= FixedCols) then
    ColWidths[FSizingIndex] := GetMinColWidth(X - FSizingOfs - CellRect(FSizingIndex, 0).Left);
    FGridState := gsNormal;

  if FTitleArrowDown and (Button = mbLeft) then
    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

  if (Button = mbLeft) and (FGridState = gsColSizing) then
    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,
// 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;

  { XP Theming }
  {$IFDEF JVCLThemesEnabled}
  if UseXPThemes and StyleServices.Enabled then
    FPaintInfo.ColSizing := False;
    FPaintInfo.ColMoving := False;
    FPaintInfo.ColPressedIdx := -1;
  {$ENDIF JVCLThemesEnabled}
zip file icon [^] (85,803 bytes) 2019-05-08 15:43
Issue History
2019-05-08 15:43 Mistral New Issue
2019-05-08 15:43 Mistral File Added:
2019-05-08 15:43 Mistral Issue Monitored: Mistral
2019-05-12 13:52 mh Note Added: 0021825
2019-05-13 09:59 Mistral Note Added: 0021833

2019-05-12 13:52   
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?
2019-05-13 09:59   
My system:
- Windows 10 x64 (real machine)
- Delphi 10.2.3 Tokyo
- JCL and JVCL installed from original Git repository