I was planning to use a ‘popover’ (a fake one based on a container) that shows to the side of the listbox row to allow editing of data (the listbox row only has one cell and draws several lines of text in different styles to make it visually appealing but doesn’t allow inline editing). The popover was intended to align to the centre of the clicked row…
I had thought that i can can estimate where the pointy bit of the popover should align by using the local x, y in the cellClick event, the row parameter of the cellClick and row.defaultRowHeight… it didn’t seem complicated as the ‘pointy’ bit will always be in the centre of the fake popover:
Popover.top = (listbox.top + listbox.DefaultRowHeight/2 + row * listbox.DefaultRowHeight) - Popover.height/2
This worked perfectly for the first set of rows, but as soon as you scroll, the ‘row’ parameter of course will give a row number higher than the visible set of rows, so the popover container renders lower down and often outside the window.
So the question is, how can i determine which of the visible rows has been clicked?
Example:
If the listbox can show 5 rows and the user scrolls so that the 25th row is the 3rd one down on the visible rows, how can i detect that it’s the 3rd row down has been clicked?
I could keep track of the scrolling via the mousewheel event - or is there a more elegant solution?