Hi Art,
On Fri, Jan 25, 2013 at 4:12 PM, Art Heimsoth <[email protected]>wrote:
> I am trying to get the horizontal scroll with a ListBox but so far am not
> successful. The .rc file content for it is:
>
> LISTBOX IDC_RPT_DETAIL, 5, 20, 402, 250, WS_TABSTOP | WS_VSCROLL |
> WS_HSCROLL | LBS_DROPDOWN | LBS_NOTIFY | LBS_USETABSTOPS
>
> The vertical scroll appears to work okay. What am I missing?
Something easily missed, and missed by a lot of people. Probably a poor
design from Microsoft.
A list box has a thing called the horizontal extent. When the list box is
first created by the operating system the horizontal extent is set to the
width of list box. Nothing is ever shown past the horizontal extent. For
the horizontal scroll bar to appear, the horizontal extent must be set
wider than the list box.
You do that with the list box setWidthPx() method. A typical sequence is
something like this:
lb = self~newListBox('IDC_LB_CITIES')
max = 10
items = .array~of("New York New York"~copies(9), -
"San Diego California"~copies(8), -
"Los Angles Californiz"~copies(10), -
"Bakersfield California"~copies(11), -
"San Jose")
do city over items
s = self~getTextSizePx(city)
if s~width > max then max = s~width
lb~insert( , city)
end
lb~setWidthPx(max)
I had to add the copies() method to make the city strings wide enough.
Of course if you know ahead of time that you need, say, 220 pixels, you can
skip the getTextSizePx() stuff and just do:
lb~setWidthPx(220)
The benefit of the getTextSizePx() in the loop is you can come back to the
program in 3 years, add a new long string, and not beat your head against
the wall trying to figure why the string is clipped in the list box. ;-)
--
Mark Miesfeld
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users