3.7.5.96 Type

LabTalk Object Type:

Utility

The type object provides output control to the Script Window, Results Log, Command Window, Messages Log, status bar, and notes window.


Properties:

Property Access Description
type.notes$ Read/write,
string

When outputting with the type.wks() method, this property contains the name of the notes window that will receive the output if specified by type.redirection.

type.notesRemainIcon Read/write,
numeric

When outputting with the type.wks() method, if the notes window specified in type.notes$ is minimized before output, then this property determines whether or not it remains minimized after output.
0 = restore the notes window (default).
1 = keep the notes window minimized.

type.notesState Read only,
numeric

Get the state of the notes window specified by type.notes. The return value is bit oriented.
Bit = 0, Value = 1: the window exists.
Bit = 1, Value = 2: the window is not hidden.
Bit = 2, Value = 4: the window contains data.
Bit = 3, Value = 8: the window has been modified since it was last saved.
Bit = 4, Value = 16: the window is minimized.

type.numCols Read/write,
numeric

The number of columns in the current output window as determined by type.redirection. After executing the type.wks(wksName) method, if the actual number of worksheet columns exceeds the value specified by numCols, then subsequent columns display below the first set of columns in the output window.

type.redirection Read/write,
numeric

Set the current output window.
Bit = 0, Value = 1: If the script is run in Script Window, then the output goes to the Script window. If the script is run in Command Window, then the output goes to Command Window. If the script is run in the LabTalk Console of Code Builder, then the output goes to LabTalk Console.
Bit = 1, Value = 2: the output goes to the Notes window specified by type.notes$.
Bit = 2, Value = 4: always send error messages to the Script window.
Bit = 0 & 2, Value = 5: the default value before Origin 8.6, which has the same functionality of combining Bit = 0 and Bit = 2 (1+4=5).
Bit = 3, Value = 8: append a carriage-return to the data sent to the current output window.
Bit = 4, Value = 16: the output goes to the Results Log. When you use the type.wks(wksName) object method to output the worksheet to the Results Log: All cell contents are output, not just the visible contents. Column names or labels not displayed in the worksheet, are ignored in the output. A cell found with "--", will output "-" to the column width.
Bit = 5, Value = 32: the output goes to the Output window in code builder.
Bit = 7, Value = 128: the output goes to the Command window. (8 SR5)
Bit = 8, Value = 256: the output always goes to Script Window.
Bit = 10, Value = 1024: the output goes to the Messages Log window. (8.6 SR0)
Bit = 16, Value = 32768: the default value since 8.6 SR0, which has the similar functionality to Value = 5, except the small difference, that is, for other output (except type or error output) in other window, e.g. OGS, the output will go to Messages Log, but not Script Window as previous version.

type.repeatCol Read/write,
numeric

If the number of columns in a worksheet exceeds the number of columns in the current output window as specified by type.numCols, then this property controls whether or not the first worksheet column is repeated for each block when outputting with the type.wks(wksName) method.
1 = repeat the first column (default) for each block.
0 = start the next block with the next column.

type.state Read only,
numeric

Get the state of the Script window. The return value is bit oriented (see type.notesState).

type.tab Read/write,
numeric

The number of characters in a tab field in the current output window. If type.tab = 0, then the individual worksheet column widths are maintained in the output window after executing the type.wks(wksName) method.

Methods:

Method Description
type.addKey(keyname)

Add a key to the type object.

type.beginResults([keyname])

Notify the Results Log of a block of results. When the Results Log receives this notification, it appends a header in the log. Headers are used to separate different blocks of results. If a keyname is passed, it will appear in the result's header with an index. The index is tracked by the type object.

type.clearResults([keyname[, firstindex[, lastindex]]])

Clear the Results Log. If a keyname is passed, then only the results with the keyname will be cleared. If no keyname is passed, then all results will be cleared. Examples:

type.clearResults(FIT); // delete all results with FIT keyname

type.clearResults(FIT3); // delete results with FIT keyname and index 3

type.clearResults(FIT,3); // same as type.clearResults(FIT3)

type.clearResults(FIT,3,8); // delete results with FIT keyname and index from 3 to 8

type.delKey(keyname)

Delete a key from the type object.

type.endResults()

Notify the Results Log that the block of results has ended. It is necessary to notify the Results Log that a block of results has ended so it can separate the logs with headers.

type.msgBox(Msg ,Title[, Button, Icon])

Display a modal Windows message box. Msg displays as the message in the window. Title displays as the title. Button: 0 = OK, 1 = OK and Cancel, 2 = Yes and No, 3 = Yes, No, and Cancel. Icon: 0 = None, 1 = Question, 2 = Information, 3 = Stop, and 4 = Exclamation. Returns the value of the button clicked on: 0 = Cancel, 1 = OK, 2 = Yes, and 3 = No.

type.outputLog(header)

Appending a header to the Results Log. Values for header:
1 = Notify the Results Log of a block of results. When the Results Log receives this notification, it appends a header to the Results Log. Headers are used to separate different blocks of results. Headers contain the date, time, and active window.
0 = Notify the Results Log that the block of results has ended. It is necessary to notify the Results Log that a block of results has ended so it can separate the logs with headers.

type.redirection(on, off)

This method allows you to turn on and off the bits for the type.redirection property. The first argument switches the bits on and the second argument switches them off. This method returns the current setting of type.redirection.

type.remind(iniSec, iniFile)

This method creates a private reminder message dialog. An Ini file is used to initialize the dialog. Each section in the ini file is used for a single message.

Sample Ini Section

[MyMessage]
;Title = My Reminder
Msg = This is my message.
Btns = 4

The following keys in the section are used:
Title = This key is optional. A string used to replace the default "Reminder" title.
Msg = This key is required. A string of the message you want displayed in the dialog.
Btns = An integer. 0 = OK, 1 = OK Cancel, 3 = Yes No Cancel, 4 = Yes No.

Origin C programmers, see PrivateReminderMessage

type.showScript(value)

Control the display of the Script window. value: 1 = show, 0 = hide.

type.showStatus(value)

Control the display of the status bar. value: 1 = show, 0 = hide.

type.wks(wksName)

Copy the contents of the specified worksheet to the current output window as determined by type.redirection.

Examples:

This script sets the Results Log as the current output window. It clears the Results Log and then outputs "Start My Output" followed by the data in the data1 worksheet, maintaining the column widths in the output.

old = type.redirection;
type.redirection = 16;
type.clearResults();
type "Start My Output";
type.repeatCol = 0;
type.tab = 0;
type.wks(data1);
type.redirection = old;