Starting with Xbase++ 1.82.0306, the method "XbpListbox:setScrollWidth()"
can be used to set the scrollable area of the listbox object. Alaska
Software is planning to release the new version of the XbpListbox
component via a public fix level (PFL) for Xbase++ 1.82. Please visit
our website at www.alaska-software.com to learn when this PFL will
become available.
":SetScrollWidth()" can be used to set the scrollable area of
the listbox object. Parameter "nWidth" must be specified in pixels.
Example:
(...)
aTabs := oListbox:getTabStops()
IF Len(aTabs) > 0
nWidthTAB := aTabs[Len(aTabs)] * (nAveCharWidth/4)
nWidthTAB += ( Len("ColumnHeader ") * nAveCharWidth )
oListbox:setScrollWidth( nWidthTAB )
ENDIF
(...)
The example code first checks whether any tab stops had been set
previously. If so, it proceeds to compute the position of the last
tab stop in pixels. It does so by using the average character width
of the font which can be determined as follows:
oPS := oListbox:lockPS()
nAveCharWidth := oPS:setFont():width
oListBox:unlockPS()
When the position of the last tab stop has been computed, it adds the
length of the column header string ("ColumnHeader") plus a safety
margin. Finally, the scrollable area of the listbox is set to the
value computed. Whenever the listbox object is made smaller than this
value, a scrollbar is displayed.
|