Jump to content


Photo

String Grid - mouse down - which cell ?


  • Please log in to reply
2 replies to this topic

#1 david_navigator

david_navigator

    Member

  • Members
  • PipPip
  • 47 posts

Posted 14 June 2018 - 09:56 AM

I need to find out which string grid cell the user clicked in. 
With the VCL there's the MouseToCell method which can be used with the Grid OnMouseDown event, but that doesn't exists for the UniStringGrid.

 

I tried adding an ExtEvent for cellmousedown, hoping that would give me the correct info

function cellmousedown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts)
{
        ajaxRequest(sender, '_cellmousedown', ['CellIndex='+cellIndex,'RowIndex='+rowIndex]);

}

But the OnAjaxEvent doesn't get called with that EventName.

So how can I find out which cell the user just clicked in (The OnSelectCell is no use for me as I want to count the number of clicks in a cell and OnSelectCell only gets called when the cell changes).

 

Thanks

 

David


  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5293 posts

Posted 14 June 2018 - 11:47 AM

ajaxRequest(sender, '_cellmousedown', ['CellIndex='+cellIndex,'RowIndex='+rowIndex]);
ajaxRequest(this, '_cellmousedown', ['CellIndex='+cellIndex,'RowIndex='+rowIndex]);

  • 0

#3 david_navigator

david_navigator

    Member

  • Members
  • PipPip
  • 47 posts

Posted 14 June 2018 - 12:06 PM

Many thanks. Obviously I have a lot to learn about javaScript :)

 

What's the difference between "this" & "sender" ?


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users