FNC Grid OnCellDblClick not working

We are using Delphi 12.1, TMS Web Core 2.6.1.1, TMS FNC Core 4.0.1.0 and TMS FNC UI Pack 6.0.1.1.
We adapted the FNC Grid demo, by setting Options.Editing.Enabled to False and assigning the event handler OnCellDblClick, but at runtime, nothing happens when double-clicking a cell.

Hi,

We have tested this here with a blank grid on the form and this works as expected. Can you point out which demo exactly you modified?

TMSWeb_FNCGrid.web. I also setup a new TMS Web application with a FNC grid. The issue remains the same, except that sometimes double-click is working but most of the time not.

We installed TMS Web Core 2.7.1.0, TMS FNC Core 4.0.3.0 and TMS FNC UI Pack 6.3.0.0, but the FNCGrid's OnCellDblClick property is still not working properly. We extended the TMSWeb_FNCGrid.web demo by just assigning an event handler to the FNCGrid's OnCellDblClick property. We tested with the current versions of Microsoft Edge and Firefox.

Hi,

We have tested this here but couldn't reproduce, what is the behavior you see? Are you clicking on normal cells or fixed cells? fixed cells have a different event handler for double-clicks.

Normal cells. Seldom double-clicking a cell works, but most of the time not.

The same here.
Delphi 11/Edge/Windows 11.

15/20 or even more random dbl-clicks to achieve 1 OnCellDblClick firing.

We have further investigated this here and indeed, we are able to reproduce double-clicks not being registered. However, when a double-click is performed, and there is some time between sequential double-clicks, we were able to register all of them. Upon testing this in a JavaScript/HTML sample without any links to TMS WEB Core whatsoever, the same behavior can be observed. If a double-click happens, and immediately after a double-click happens again, all double-clicks are registered as normal clicks. I can only suspect that this is a limitation of the browser. You can test and verify this here:

More info about click handling can be found here:

The PointerEvent object passed into the event handler for click has its detail property set to the number of times the target was clicked. In other words, detail will be 2 for a double-click, 3 for triple-click, and so forth. This counter resets after a short interval without any clicks occurring; the specifics of how long that interval is may vary from browser to browser and across platforms. The interval is also likely to be affected by user preferences; for example, accessibility options may extend this interval to make it easier to perform multiple clicks with adaptive interfaces.

We'll investigate if we can handle double-clicks differently, but for now, this is the default JavaScript behavior in a browser

Following this link and it's live example, using the same browser, it does recognize double clicks made at the same speed as when testing the FNC Grid.

At the same FNCGrid test program, at the same form, applied a double click event on a label, and it never failed in reasonable speeds.

Seems like you can't get a celldblclick if there's more than 'x' ms between first mousedown & second mouseup, while label dblclick seems to fire with a bit more.
In fact, when I double click a lot faster than a normal double click, almost all celldblclicks are fired, as seen bellow

20250115 021415831 - label mouse down
20250115 021415999 - label mouse up
20250115 021415999 - label click
20250115 021416254 - label mouse down
20250115 021416374 - label mouse up
20250115 021416374 - label click
20250115 021416374 - label dbl click

20250115 021424349 - label mouse down
20250115 021424542 - label mouse up
20250115 021424542 - label click
20250115 021424807 - label mouse down
20250115 021424974 - label mouse up
20250115 021424974 - label click
20250115 021424974 - label dbl click

Label dbl click not fired. 638ms between 1st md & 2nd mu.
20250115 021429119 - label mouse down
20250115 021429295 - label mouse up
20250115 021429295 - label click
20250115 021429646 - label mouse down
20250115 021429757 - label mouse up
20250115 021429758 - label click

20250115 021433862 - label mouse down
20250115 021434046 - label mouse up
20250115 021434047 - label click
20250115 021434143 - label mouse down
20250115 021434270 - label mouse up
20250115 021434270 - label click
20250115 021434270 - label dbl click

20250115 021442854 - label mouse down
20250115 021442967 - label mouse up
20250115 021442967 - label click
20250115 021443302 - label mouse down
20250115 021443422 - label mouse up
20250115 021443422 - label click
20250115 021443422 - label dbl click

20250115 021454713 - mouse down
20250115 021454758 - mouse up
20250115 021454777 - cell click
20250115 021454863 - mouse down
20250115 021454918 - mouse up
20250115 021454933 - cell click
20250115 021454934 - cell dbl click

20250115 021504834 - mouse down
20250115 021504958 - mouse up
20250115 021504971 - cell click
20250115 021505070 - mouse down
20250115 021505166 - mouse up
20250115 021505178 - cell click
20250115 021505179 - cell dbl click

20250115 021518824 - mouse down
20250115 021518957 - mouse up
20250115 021518969 - cell click
20250115 021519086 - mouse down
20250115 021519214 - mouse up
20250115 021519227 - cell click

20250115 021537657 - mouse down
20250115 021537773 - mouse up
20250115 021537786 - cell click
20250115 021537895 - mouse down
20250115 021538078 - mouse up
20250115 021538090 - cell click

20250115 021559992 - mouse down
20250115 021600110 - mouse up
20250115 021600122 - cell click
20250115 021600278 - mouse down
20250115 021600462 - mouse up
20250115 021600474 - cell click

20250115 021614360 - mouse down
20250115 021614470 - mouse up
20250115 021614482 - cell click
20250115 021614542 - mouse down
20250115 021614654 - mouse up
20250115 021614665 - cell click

20250115 021626752 - mouse down
20250115 021626814 - mouse up
20250115 021626825 - cell click
20250115 021626910 - mouse down
20250115 021626966 - mouse up
20250115 021626978 - cell click
20250115 021626979 - cell dbl click

20250115 021636280 - mouse down
20250115 021636326 - mouse up
20250115 021636338 - cell click
20250115 021636430 - mouse down
20250115 021636485 - mouse up
20250115 021636497 - cell click
20250115 021636498 - cell dbl click

20250115 021644391 - mouse down
20250115 021644534 - mouse up
20250115 021644547 - cell click
20250115 021644639 - mouse down
20250115 021644742 - mouse up
20250115 021644755 - cell click
20250115 021644756 - cell dbl click

20250115 021655903 - mouse down
20250115 021656029 - mouse up
20250115 021656042 - cell click
20250115 021656135 - mouse down
20250115 021656342 - mouse up
20250115 021656354 - cell click

20250115 021703510 - mouse down
20250115 021703622 - mouse up
20250115 021703637 - cell click
20250115 021703750 - mouse down
20250115 021703990 - mouse up
20250115 021704002 - cell click

20250115 021715424 - mouse down
20250115 021715638 - mouse up
20250115 021715649 - cell click
20250115 021715743 - mouse down
20250115 021715797 - mouse up
20250115 021715810 - cell click
20250115 021715811 - cell dbl click

20250115 021727624 - mouse down
20250115 021727726 - mouse up
20250115 021727738 - cell click
20250115 021727806 - mouse down
20250115 021727856 - mouse move
20250115 021727869 - mouse up
20250115 021727881 - cell click
20250115 021727882 - cell dbl click

20250115 021736471 - mouse down
20250115 021736646 - mouse up
20250115 021736659 - cell click
20250115 021736785 - mouse down
20250115 021736790 - mouse move
20250115 021737006 - mouse up
20250115 021737017 - cell click

20250115 021748079 - mouse down
20250115 021748198 - mouse up
20250115 021748212 - cell click
20250115 021748326 - mouse down
20250115 021748518 - mouse up
20250115 021748532 - cell click

20250115 021754744 - mouse down
20250115 021754845 - mouse up
20250115 021754875 - cell click
20250115 021754901 - mouse down
20250115 021754998 - mouse up
20250115 021755010 - cell click
20250115 021755011 - cell dbl click

Strange, we are seeing different behavior in both Chrome and Edge. But I'm working on Windows 10. Either way, the documentation (MDN) also mentions different behavior depending on the browser. In my experience, I needed to perform a double-click fast, but have some kind of delay between the first and the second to be able to see them both. As said we'll investigate a workaround but it's clear that it doesn't produce a consistent behavior.

Are you sure it doesn't have anything to do with web fnc grid internal handling of mouse events ? In the final code, they're not handled as pure native event listeners. There is a lot of intermediate logic.
With another control it's ok, with the grid, not ok.

It only happens when you keep clicking repeatdly on the same cell without moving.

Using the attached html, a plain html table responds to dbl click events with "much slower double clicks" than what's being required for the fnc grid cell ondblclick.

testedblclick.html (2.9 KB)

2025-01-15T11:17:13.968Z [Mouse Down]: Data 8-2
2025-01-15T11:17:14.035Z [Mouse Up]: Data 8-2
2025-01-15T11:17:14.036Z [Click]: Data 8-2
2025-01-15T11:17:14.124Z [Mouse Down]: Data 8-2
2025-01-15T11:17:14.220Z [Mouse Up]: Data 8-2
2025-01-15T11:17:14.221Z [Click]: Data 8-2
2025-01-15T11:17:14.221Z [Double-Click]: Data 8-2

2025-01-15T11:17:15.435Z [Mouse Down]: Data 6-2
2025-01-15T11:17:15.563Z [Mouse Up]: Data 6-2
2025-01-15T11:17:15.564Z [Click]: Data 6-2
2025-01-15T11:17:15.668Z [Mouse Down]: Data 6-2
2025-01-15T11:17:15.763Z [Mouse Up]: Data 6-2
2025-01-15T11:17:15.764Z [Click]: Data 6-2
2025-01-15T11:17:15.765Z [Double-Click]: Data 6-2

2025-01-15T11:17:16.284Z [Mouse Down]: Data 9-2
2025-01-15T11:17:16.404Z [Mouse Up]: Data 9-2
2025-01-15T11:17:16.405Z [Click]: Data 9-2
2025-01-15T11:17:16.580Z [Mouse Down]: Data 9-2
2025-01-15T11:17:16.699Z [Mouse Up]: Data 9-2
2025-01-15T11:17:16.700Z [Click]: Data 9-2
2025-01-15T11:17:16.701Z [Double-Click]: Data 9-2

2025-01-15T11:17:17.756Z [Mouse Down]: Data 11-3
2025-01-15T11:17:17.876Z [Mouse Up]: Data 11-3
2025-01-15T11:17:17.877Z [Click]: Data 11-3
2025-01-15T11:17:18.053Z [Mouse Down]: Data 11-3
2025-01-15T11:17:18.139Z [Mouse Up]: Data 11-3
2025-01-15T11:17:18.140Z [Click]: Data 11-3
2025-01-15T11:17:18.141Z [Double-Click]: Data 11-3

2025-01-15T11:17:18.839Z [Mouse Down]: Data 14-3
2025-01-15T11:17:18.996Z [Mouse Up]: Data 14-3
2025-01-15T11:17:18.997Z [Click]: Data 14-3
2025-01-15T11:17:19.108Z [Mouse Down]: Data 14-3
2025-01-15T11:17:19.220Z [Mouse Up]: Data 14-3
2025-01-15T11:17:19.221Z [Click]: Data 14-3
2025-01-15T11:17:19.221Z [Double-Click]: Data 14-3

2025-01-15T11:17:20.296Z [Mouse Down]: Data 16-3
2025-01-15T11:17:20.388Z [Mouse Up]: Data 16-3
2025-01-15T11:17:20.388Z [Click]: Data 16-3
2025-01-15T11:17:20.556Z [Mouse Down]: Data 16-3
2025-01-15T11:17:20.668Z [Mouse Up]: Data 16-3
2025-01-15T11:17:20.669Z [Click]: Data 16-3
2025-01-15T11:17:20.669Z [Double-Click]: Data 16-3

2025-01-15T11:17:21.640Z [Mouse Down]: Data 18-3
2025-01-15T11:17:21.763Z [Mouse Up]: Data 18-3
2025-01-15T11:17:21.764Z [Click]: Data 18-3
2025-01-15T11:17:21.876Z [Mouse Down]: Data 18-3
2025-01-15T11:17:22.059Z [Mouse Up]: Data 18-3
2025-01-15T11:17:22.060Z [Click]: Data 18-3
2025-01-15T11:17:22.061Z [Double-Click]: Data 18-3

2025-01-15T11:17:22.993Z [Mouse Down]: Data 20-3
2025-01-15T11:17:23.100Z [Mouse Up]: Data 20-3
2025-01-15T11:17:23.101Z [Click]: Data 20-3
2025-01-15T11:17:23.244Z [Mouse Down]: Data 20-3
2025-01-15T11:17:23.372Z [Mouse Up]: Data 20-3
2025-01-15T11:17:23.373Z [Click]: Data 20-3
2025-01-15T11:17:23.374Z [Double-Click]: Data 20-3

2025-01-15T11:17:24.180Z [Mouse Down]: Data 19-4
2025-01-15T11:17:24.308Z [Mouse Up]: Data 19-4
2025-01-15T11:17:24.309Z [Click]: Data 19-4
2025-01-15T11:17:24.444Z [Mouse Down]: Data 19-4
2025-01-15T11:17:24.611Z [Mouse Up]: Data 19-4
2025-01-15T11:17:24.613Z [Click]: Data 19-4
2025-01-15T11:17:24.614Z [Double-Click]: Data 19-4

2025-01-15T11:17:26.785Z [Mouse Down]: Data 12-4
2025-01-15T11:17:26.915Z [Mouse Up]: Data 12-4
2025-01-15T11:17:26.916Z [Click]: Data 12-4
2025-01-15T11:17:27.012Z [Mouse Down]: Data 12-4
2025-01-15T11:17:27.187Z [Mouse Up]: Data 12-4
2025-01-15T11:17:27.188Z [Click]: Data 12-4
2025-01-15T11:17:27.189Z [Double-Click]: Data 12-4

2025-01-15T11:17:28.200Z [Mouse Down]: Data 8-4
2025-01-15T11:17:28.323Z [Mouse Up]: Data 8-4
2025-01-15T11:17:28.325Z [Click]: Data 8-4
2025-01-15T11:17:28.452Z [Mouse Down]: Data 8-4
2025-01-15T11:17:28.619Z [Mouse Up]: Data 8-4
2025-01-15T11:17:28.621Z [Click]: Data 8-4
2025-01-15T11:17:28.622Z [Double-Click]: Data 8-4      (+400ms !)

2025-01-15T11:17:29.568Z [Mouse Down]: Data 5-4
2025-01-15T11:17:29.691Z [Mouse Up]: Data 5-4
2025-01-15T11:17:29.692Z [Click]: Data 5-4
2025-01-15T11:17:29.797Z [Mouse Down]: Data 5-4
2025-01-15T11:17:29.899Z [Mouse Up]: Data 5-4
2025-01-15T11:17:29.901Z [Click]: Data 5-4
2025-01-15T11:17:29.902Z [Double-Click]: Data 5-4

It's just handled with addEventListener('dblclick' (which is in the same mdn documentation.

We'll do some more investigation stay tuned.

Hi,

Can you edit the WEBLib.Controls.pas unit, and replace

procedure TControl.Capture;
begin
  FCaptureDown := True;
  window.setTimeout(@StartCapture, 100);
end;

with

procedure TControl.Capture;
begin
  Exit;
  FCaptureDown := True;
  window.setTimeout(@StartCapture, 100);
end;

and test if that improves or fixes the issue. Note that this is just for testing purposes, as the code will break existing functionality related to click/dragging and keeping mouse tracking within the control.

Yes, it fixes the DblClick issue.
100% OnCellDblClick fired, even at low speed clicking:

20250119 181752315 - cell click
20250119 181752623 - cell click
20250119 181752624 - cell dbl click
20250119 181754701 - cell click
20250119 181754997 - cell click
20250119 181754998 - cell dbl click
20250119 181804349 - cell click
20250119 181804700 - cell click
20250119 181804701 - cell dbl click
20250119 181805972 - cell click
20250119 181806245 - cell click
20250119 181806246 - cell dbl click
20250119 181807934 - cell click
20250119 181808189 - cell click
20250119 181808190 - cell dbl click
20250119 181809279 - cell click
20250119 181809574 - cell click
20250119 181809576 - cell dbl click
20250119 181811636 - cell click
20250119 181811974 - cell click
20250119 181811975 - cell dbl click
20250119 181817604 - cell click
20250119 181818055 - cell click
20250119 181818058 - cell dbl click
20250119 181819269 - cell click
20250119 181819683 - cell click
20250119 181819687 - cell dbl click
20250119 181820754 - cell click
20250119 181821078 - cell click
20250119 181821079 - cell dbl click

BTW, found an issue with TWebMemo. Tried to use .ScrollBy method. It shows in code completion, compiles (pascal), but when Pas2JS is run, it says: identifier not found "ScrollBy"
image

image

Maybe my WebCore is not updated, but reported just to check.

We have added the TWebMemo.ScrollBy() method for runtime.
Next update will have this.

For now, please use this workaround, we have yet to find a proper solution for this issue in TMS WEB Core.

Hi,

Can you remove the Exit; and try this (added FCaptureDown := False;)

function TControl.HandleDoDblClick(Event: TJSMouseEvent): Boolean;
begin
  FCaptureDown := False;
  FElementEvent := Event;
  if (eeDblClick in EventStopPropagation) then
    StopPropagation;
  if Enabled then
    DblClick;
  Result := True;
  FElementEvent := nil;
end;