Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Right Justify in a listbox
Message
From
01/11/1998 17:48:39
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00153254
Message ID:
00153312
Views:
21
>I have a list box with three columns. The third column display dollar amounts, but is left justified. Is there a way to get the column to right justify? Any feedback is appreciated.
>
>Marcus.
Hello Marcus!

The trick: expand all number for the same width,add some space on the the left side of the number. (The problem: width of a space char, how much wider or shrinker than a number, and a point? If these are equals, padl is suitable (Courier font type))
I used the following function for this problem:
(It is designed for MSSanserif font, I always use this one)

function cFormatCurrency
lparameter tyAmount, tnWidth
local lcVissza, lnNoOfSpaces
if sign(tyOsszeg)=-1
tnSzelesseg=tnSzelesseg+1
endif
lcVissza=alltrim(transform(tyAmount,"### ### ###.##"))
lnNoOfSpaces=occurs(' ',lcVissza)
lcVissza=space(max(tnWidth-lnNoOfSpaces-2*(len(lcVissza)-lnNoOfSpaces-1),0))+lcVissza
return lcVissza


Good luck!

BB
Previous
Reply
Map
View

Click here to load this message in the networking platform