GRAPHIC SPLIT statement  

Purpose

Splits a string into two parts for display on a graphic target.

Syntax

GRAPHIC SPLIT [WORD] MainStr, Part1Len To Part1Var, Part2Var

Remarks

Generally speaking, GRAPHIC SPLIT allows you to determine how much text will fit on a line (or a line section), so you don't overrun the end.  This is critical with variable-width fonts.  Since these text characters have different widths, you cannot rely on a simple character count.

GRAPHIC SPLIT separates the MainStr string expression into two parts, which are then assigned to the two string variables specified by Part1Var and Part2Var.  The numeric expression Part1Len specifies the maximum width of the print field, using page units.  After completion of GRAPHIC SPLIT, the Part1Var will contain those characters which can be safely displayed in the print field.  The Part2Var will contain the remaining characters, which might be displayed on following lines.

Since this operation creates a "line break" not contemplated in the original text, you may have to modify the results in order to obtain the best appearance.  For example, it's usually best to remove any leading spaces from Part2Var before printing it.

If the WORD option is included, PowerBASIC guarantees that Part1Var will not end on a partial word.  This may require that Part1Len is adjusted to a smaller value.  In that case, Part2Var would be assigned these characters to compensate.

See also

GRAPHIC CELL, GRAPHIC PRINT, GRAPHIC SET SCROLLTEXT, GRAPHIC SET WORDWRAP, GRAPHIC SET WRAP, SPLIT