>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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement