=> -----Original Message-----
=> From: [EMAIL PROTECTED] 
=> [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
=> Sent: Thursday, March 29, 2007 11:35
=> To: [email protected]
=> Subject: RE: VFP 6: Formatting a negative value in a report
=> 
=> So I take it if you want a proportional font with negative 
=> values wrapped in parens you need a font where the width of 
=> the non-breaking space and the right paren match. Anyone 
=> know of one or is there a function that returns the width of 
=> a character in a specified font. Seems there's one for avg 
=> width and one for max width.
=> 
=> Regards,
=> 
=> Andrew Baker
=> e-mail: [EMAIL PROTECTED]
=> 
Actually, there is another way but I could not remember it when I wrote my 
original response.

Putting the leading (left) paren in place is fairly straightforward.  The trick 
is to leave room for the right paren even when you don't need one (i.e. a 
positive number).  The way to get around this is to make the right paren a 
separate field that contains either a right paren or nothing.

Thus you have two fields, one for the number:

iif(v<0,"(","")+ltrim(trans(abs(v),"#,###.##))

and a second field immediately to the right of the first:

iif(v<0,")","")

Now you don't care what the font metrics are as long as your field sizes are 
large enough to hold the displayed data.

B+
HALinNY


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to