Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Right Justify in a listbox
Message
De
01/11/1998 17:48:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00153254
Message ID:
00153312
Vues:
20
>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
Fil
Voir

Click here to load this message in the networking platform