Hi,
I am using an UltraGrid. How can know whether a double click is inside a cell or on its edge? I need to catch a double click on a cell edge to do resize width of column(s) to fit all cells.
Your help is greatly appreciated!
Best Regards,Shaolin
Hi Shaolin,
The grid has built-in functionality to auto-size the column width to it's contents when the user double-clicks on the column egde. Ad this functionality is enabled by default. So there's no reason for you to implement this yourself. Is there some particular reason you want to turn off the grid's auto-size and do your own? Or were you just not aware that the grid already does this?
Hi Mike,
Thanks for your quick response.
I am using this grid's auto-size feature. The default implementation is slow and it measures the displayed text in every cell of a column. I would like to implement my own column auto-size logic and make it faster. We have large amount of data, possibly hundreds of thousands rows. We also implemented some custom cell UI element class, so the default auto-size won't work. We also need to auto-size all columns when user double clicks on a column edge while pressing Ctrl key.
I figured out a way to check whether double-click is on a column edge. class UIElement has method AdjustableElementFromPoint and GetAdjustableCursor, and these two method return a null if the double-click is not on the edge.
Thanks again!
It might be better to use PointInAdjustableArea instead of relying on GetAdjustableCursor. But it probably doesn't matter very much.
It definitely makes more sense to use PointInAdjustableArea instead of those two method I mentioned.
Thanks so much for your help!