Posted by Robert G Laurin on April 06, 2011 at 15:02:01: Uploaded files: 1
ok, this is weird.
See attached picture of my trace
I have this print routine that has been working for years! All the sudden it acts bizarre. After putting tons of trace I narrowed it down to this:
I have an variable called USR.FONT.SIZE(WPFontMax) declared 10.6 where WPFontMax = 4.
I have a SELECT CASE USR.FONT.SIZE(CURRENT.FONT) where CURRENT.FONT =1 and USR.FONT.SIZE = 0 (AKA .000000)
In the select case I check for CASE IS GT 0, CASE 0 and CASE ELSE
I'd expect CASE 0 to be executed, nope! found that CASE ELSE was executed (treats it as a negative non-zero).
So I tought lets try with SGN( )
I changed the code to SELECT CASE SGN(USR.FONT.SIZE(CURRENT.FONT))
This time it is the CASE IS GT 0 that got executed??? (treats it as positive non-zero)
Oddly, I am sure that the CASE 0 should be executed and has been used for years.
This was tested with 2008.398 and 2010.431
--------------------------------
For the curious, here's the logic of this.
I use this print routine to print Windows reports. I have 4 different font size I re-use, where 1 is STD, 2 is for Titles and 3,4 are user. If I do not specify the font size, it will compute it using the printable width divided by the number of columns (length) of the headers (in 2 user supplied variables). I can force a font size by providing a positive number (in points) or a negative number for CPI. It will automatically use 1.2x for Titles. So this is why this routine at initialization checks for GT 0, 0 or ELSE.
Most of our reports use this routine with no default font size. This allow adjusted printing for different type of printers (any Windows printer - lasers, inkjet, dot or PDFs).
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.