Reports - one more time

Sarah Reichelt sarahr at genesearch.com.au
Thu Apr 11 20:13:01 EDT 2002


I have done a bit of work on such a display and here are the techniques 
I used:

A single field with tab-stops (turn on the vertical grid so you can see 
what's happening)

Shorten any text that is longer than the tab-stops:
	I do this using a hidden field with the same text properties and 
the same width as the tab-stops.
	This function returns the shortened version of the text: (thanks to 
Geoff Canyon for this function)
	The "Format Check" field must NOT be set to dontWrap and the 
maximum number of complete words will be returned:
	
	function truncateToFit theString
	  put theString into fld "Format Check"
	  return (line 1 of the formattedText of fld "Format Check")
	end truncateToFit

	If you want the maximum number of characters and don't care about 
complete words,
		then set the dontWrap of the Format Check field to true and 
use this function instead:

	function trimToFit theString
	  put theString into fld "Format Check"
	  repeat while the formattedWidth of fld "Format Check" > the width 
of fld "Format Check"
	    delete last char of fld "Format Check"
	  end repeat
	  return fld "Format Check"
	end trimToFit

Use the format function to right-align numbers:
	format("%6.2f", myNumber)  -- 4.7  returns "  4.70"
	format("%6d",myNumber)     -- 56   returns "    56"

Then use revPrintField and in the latest versions, it produces a 
beautifully aligned print-out.

Cheers,
Sarah


On Friday, April 12, 2002, at 08:14  am, Barry Levine wrote:

> I posted this question once before but only received one response 
> (which I have not tried yet). How are you handling the printing of 
> reports through Revolution? Do you put them into a field with tabs to 
> separate columns of numbers/text? How about multiple fields lined up 
> parallel to each other? What method do you use? Are there any stacks 
> posted anywhere that illustrate the technique?





More information about the use-livecode mailing list