CTextView:delete CTextView:GetWordwrap

CTextView:Printf


The Printf method writes formatted text to the text window wrapped by this CTextView object. This method provides functionality like the printf function in the C language. The Printf and Wprintf functions are global relatives of this method.

Syntax

bResult = CTextView:Printf( sFmt, ... )

    sFmt is a format string.

    ... refers to an optional list of arguments (see Remarks).

    On success, this method returns true.

    On failure, this method returns false.

Remarks

The Printf method takes 1 or more arguments. The first argument is a string that may be either the value to print or a format to be used for interpreting any additional arguments. Additional arguments provide values for the % fields embedded in the format string. The syntax of this function is compatible with the printf in the C or C++ language.

Example

The script fragment below creates a new CTextView and writes formatted text to it:

 

T = CTextView:new("My window")

-- create a new CTextView V

s = "My string" ; n = 12.553

-- string and number to print

T:Printf("'%s': v=%-12lg\n", s, n/2.1 ))

-- do a formatted print to T

  ...

-- other script commands...

T:delete()

-- delete T when no longer needed.

Related Topics

CTextView, Sprintf, CFile:Printf, Wprintf