TWebDBGrid: click events behaving differently

Hi,

If I have a TWebButton and the onclick opens a dialog form (asynchroneously), however fast I try to click on the button (multiple times) the dialog form will only open once.

If I have a TWebDBGrid (OnCellClick, OnDoubleClick): if I do the same (click multiple times very fast on a cell) the event is being called multiple times and I will end up with duplicate names (ID's) as the dialog form is being opened multiple times.

I tried:

  • first thing in the eventhandler is to disconnect it in code
  • reattach the event handler when the dialog form is being closed

I still have the issue: it seems that underlying javascript events are being buffered in some way ?

The only work around I found was to keep a variable, like

  • FEventClicked = false
  • first statement in the evenhandler: if FEventClick then exit;
  • second statement in the eventhandler: FEventClick = true;
  • when freeing the dialog form: FEventClick = false;

Suggestion is to disable the button from the ButtonClick event before you asynchronously launch the form

Thanks, currently I am using the OnCellClick event as the OnButtonClick is not yet usable in the TWebDBGrid, so I have no reference to the button I clicked on in the grid.

I assume the OnButtonClick will have a reference to the button that was click on ? In which case I can temporarily disable it.

The parameters are the coordinates of the cell in which the button is that triggered the click. You can use grid.CellElements[col,row]:TJSHTMLElement to get to the HTML elements that are in the cell.