Calculate listbox column X of a given column

I would like to display a window always below clicked row of column 5 aligning it with left side of column 5, which is the X value of clicked column 5.

clicking column 5 works fine!

If I click column 1 … 4, is there a way to get the X value of column 5, so I can align the window below column 5 ?

Don’t you know the column widths ?

If not, look at the LR for where to get them… and compute.

thanks Emile,
I have to do some calculations with column width depending which column has been double clicked.

Yes, that what I meant.

works perfect !!!

I always use column widths with percentage…

At least in API 1 use:


In API 2 it’s


I have another question. Relatively to listbox 0,0 I can calculate this:

But how to calculate this? (someone dragged the scrollbar)

Hah! I found it! Using DesktopListBox.ScrollPositionX

Why not use ColumnFromXY ?

It is hard to tell from your question exactly what you want to know, but the above is ideal for taking the X,Y coordinates of a mouse click and determining what column it represents. I’ve not yet had the need to otherwise determine where a column boundary is located, but depending on your need it seems like it should be able tl computed by using the above in an algorithm.

I wanted to know the exact X pointed in my red arrows, where some starting column X was. I missed how to find the displacement and then I’ve found DesktopListBox.ScrollPositionX

Because I wanted to find X

in the listbox cell clicked event do this:

positionX = system.MouseX - x + calculateColumnXposition

loop from clicked column to wanted column(5)
and use listbox.ColumnAt ( li_column ).widthActual to add up the column widths.
the total column widths can be positive or negative depending on if clicked column is before or after your wanted column(5).

I don’t need to click cells to know where the X of any columns are. With




I know every X I need.