Search Locate Previous Next Contents

leaf.Place – place text into frame

This is the most basic routine for adding one or more lines of text to a frame. It does not attempt any wrapping, but will respect the frame edges if you have set ‘Clip’ to 1 as a property of the frame.

leaf.Place 'Hello, world'

Returns (shyly) the number of lines remaining in the frame (assuming the current vertical pitch).

You can pass the abbreviation of a style as the optional left argument, for example to place a major heading:

'Heading' leaf.Place 'Main Title'

This will apply the style, place the text, and reverse the style.

Placing several lines
If you already know exactly where the line breaks should come (for example in a function listing) you should use this function to place a matrix of text into the current frame. For example:

leaf.Place ŒCR 'myfn'

It will be written at the current left margin, but note that no check is made on the width, so over-long lines will simply overflow the frame to the right (unless the frame has been set to clip). No wrapping is attempted, but right or centred alignment will work normally. Naturally, it is much faster to place text than to flow it with leaf.Flow.

Often this will be used with a specific style, for example to control unfortunate breaks in function listings:

'code' leaf.DefineStyle ('Font' 'APL,9/11')('keep' 12)
   © ... later
'code' leaf.Place ŒCR 'myfn'

Note that HTML <b>tags</b> such as this are not supported by this function. If you need these, you must use leaf.Flow.



Continue to: leaf.PopFrame – revert to previous frame
© Copyright Causeway Graphical Systems Ltd 2001