Listbox size with and without scrollbars

Anyone worked out a good cross-platform formula for the usable area of a listbox that has auto-hide vertical and horizontal scrollbars?

  1. I want both scrollbars to auto-hide.
  2. listbox.height and listbox.width is the same whether there’s a horizontal or vertical scrollbar or not.
  3. Scrollbars are different sizes on different platforms, and can be user-adjusted on Windows.

Seems to me this is gonna be WAY too much work for what should be pretty simple. i.e.

[code]ListBox.ActualWidth = ListBox.Width - ListBox.VScrollBar.Width

ListBox.ActualHeight = ListBox.Height - ListBox.HScrollBar.Height[/code]

Even better would be a function like ListBox.VisibleRowCount and ListBox.VisibleColumnCount that would show the actual number of shown Rows and Columns whether or not there were scrollbars…

It was all so easy back in the VS days… :wink:

[quote=467822:@Andy Broughton]Anyone worked out a good cross-platform formula for the usable area of a listbox that has auto-hide vertical and horizontal scrollbars?
[/quote]

yes…I needed that ability for my MergeableCellListbox subclass.

RowFromXY and ColumnFromXY are your friends… They return -1 if the point is in the header OR a visible scrollbar…

You can use that to both see if they are visible as well as measure their size.

  • karen