On Sat, Jan 26, 2013 at 2:29 PM, Art Heimsoth <artst...@artheimsoth.com>wrote:

> I don't think using 8 e's or any fixed size for tab characters would
> work as desired.  In my case, the max value I got from trying to
> find the px size was 557 but the actual width that was needed for
> the list box was 1190 - almost twice the px size.  If the size is not
> calculated without the tab expansion, since a tab could represent
> any amount based on the setTabulators values, a general average
> may not be close to the actual.  Also, I did try having the setWidthPx
> statement immediately after the setFont statement, but I believe
> the default windows font was still used.


It is not the setWidthPx that needs to be after the setFont, it is the
getTextSizePx method.  And the getTextSizePx() has to be invoked on the
list box, not on the dialog:

  *-- set the font for the list box*
  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 = *lb~getTextSizePx(city)*
    if s~width > max then max = s~width
    lb~insert( , city)
  end
  lb~setWidthPx(max)


In the above, getTextSizePx() will use the font of the list box to
calculate the size.

Nevertheless, you're correct, the setTabulators() will make any attempts to
calculate the size needed from the string itself pointless.

What you could do is calculate where the last tabulator is and then add the
length of the string that follows the last tab to it.

--
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
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to