WgTextTool Procedure
Creates a scrolling window for viewing text from a file or character string.
Usage
WgTextTool
 
note
Either the File or the Text keyword must be supplied to identify the text that WgTextTool will display.
Keywords
Cols — The number of text columns to display when the window is first created.
File — The name of the file to display. The File and Text keywords are mutually exclusive, and one of them must be used.
Parent — The widget or shell ID of the parent widget (long). If parent is not specified, WgTextTool runs on its own (i.e., in its own event loop).
Position — A two-element vector specifying the x- and y-coordinates of the upper-left corner of the TextTool window (long integer). The elements of the vector are [x, y], where x (horizontal) and y (vertical) are specified in pixels. These coordinates are measured from the upper-left corner of the screen.
Rows — Number of text rows to display when the window is first created.
Shell — The ID of the newly created widget. If the procedure fails, zero (0) is returned.
Text — A string containing the text that will be displayed. The Text and File keywords are mutually exclusive, and one of them must be used.
Title — A string containing the title that appears in the header of the TextTool window. If not specified, either the name of the file is used for the title, or when TextTool is displaying a string, the value of the title defaults to “Scrolling Window”.
Write — If set and nonzero, allows the displayed text to be edited. By default, the WgTextTool text field is read-only.
SaveTo — If set and nonzero, the WgTextTool widget is created with a Save To File button, in addition to a default Dismiss button. Clicking on the Save to File button allows the displayed text to be written to a file.
Color/Font Keywords
For additional information on the color and font keywords, see Setting Colors and Fonts in the PV‑WAVE Application Developer’s Guide.
Background — Specifies the background color name.
Basecolor — Specifies the base color.
Font — Specifies the name of the font used for text.
Foreground — Specifies the foreground color name.
MSFont — Adds support for Windows fonts.
Bfont — Specifies the name of the font used for widget pushbutton(s).
MSbfont — (Windows only.) Specifies the name of the font used for widget pushbutton(s).
Discussion
WgTextTool is a window, shown in Figure 19-13: WgTextTool Window, that lets you view text from a string or from a file.
 
Figure 19-13: WgTextTool Window
 
note
The text displayed in the window is read only; it cannot be edited.
Interacting with the Window
The standard text editing functions are available. In Motif, this means the left mouse button and the middle mouse button can be used to copy text. However, in the text edit popup menu, only the Copy function will be sensitized, because the text is read-only.
Use the Dismiss button (or the TextTool window’s window manager menu) to destroy the window when you are finished viewing the text.
Event Handling
You can use the TextTool widget in one of the following two ways:
*From the WAVE> prompt — Enter the procedure name at the WAVE> prompt to display the TextTool widget. The TextTool widget handles its own event loop by calling WwLoop.
*Stand-alone widget in its own window created by another application — The TextTool widget has a Main window, but the application (not the TextTool widget) handles the event loop by calling WwLoop.
The output parameter shell can be returned only if you also supply the input parameter parent.
Example
Enter the commands shown below into a file, and compile the procedure with the .RUN command. If the variable parent is defined, WgTextTool is created as a child of parent; otherwise, WgTextTool runs on its own (i.e., in its own event loop).
When you are finished interacting with the WgTextTool window, close it by clicking the Dismiss button.
PRO Sample_wgtexttool, parent, tool_shell
   filename = GETENV('WAVE_DIR')+'/COPYRIGHT'
   IF N_ELEMENTS(parent) NE 0 THEN BEGIN
      ; Create WgTextTool as a child of "parent". The window of
      ; the newly created widget is returned via the optional
      ; output parameter "tool_shell".
      WgTextTool, File=filename, Parent=parent, $
         Shell=tool_shell
   ENDIF ELSE BEGIN
      ; Create WgTextTool and display it as its own Main window.
      WgTextTool, File=filename
   ENDELSE
END
See Also
For more information about how to write an application program based on PV‑WAVE Widgets or Widget Toolbox, refer to the PV‑WAVE Application Developer’s Guide.