XmNvisibleItemCount
is supposed to return the number of visible items in a list. Unfortunately, it does not return the right values when I resize the window.
XtVaGetValues(myWidget, XmNvisibleItemCount, &vic, XmNitemCount, &ic, NULL);
The above returns nine
every time, which is the number of items visible in the list when my window is opened. When I resize the window, however, it is still nine
! Despite the visible items being three
if I shrink the window or eleven
if I expand the window.
How do I get XmNvisibleItemCount
to return the right number of visible items in a list when a window is resized?
The XmNvisibleItemCount is not set by the widget during resize, but rather by the programmer when the widget is created. If the XmList is a child of a manager widget that manages its size, the attribute is ignored.
If you want to know the number of visible items (what would that be good for anyhow?), you need to calculate that yourself from the item height and the list dimensions.