Initializing Wave Widgets
The Wave Widgets function WwInit initializes Wave Widgets. You must place a call to WwInit at the beginning of any application that uses Wave Widgets. WwInit does the following:
*Establishes a connection to the X Windows server.
*Initializes Xt Intrinsics.
*Initializes the Motif Toolkit (or the Windows Advanced Controls (WAC) Library under Windows).
*Initializes Wave Widgets.
*Creates a top-level shell.
*Creates a layout widget inside the top-level shell.
WwInit has the following form:
top = WwInit(name, class, workarea [, keywords])
The name parameter specifies the name of the application, and the class parameter indicates a more general category of application class. WwInit also creates the first top-level shell or root window and an initial layout widget. The ID of the layout widget is returned by the workarea parameter. The function returns the ID of the top-level shell. For example:
top=WwInit('simple_image','Examples',layout,$
Background = 'Skyblue')
where simple_image is the name of the application, and Examples specifies a general class to which simple_image belongs. The layout parameter returns the ID of the layout widget that is created inside the top-level shell. Finally, a background color is specified with the Background keyword. The ID of the top-level shell is returned in the variable top. For more information on the top-level shell, see "The Widget Hierarchy".
One purpose of specifying a general class of application (the class parameter) is that resources can be shared, via a resource file, among elements of that class. In general, Wave Widgets applications do not require a resource file. Some developers, however, may create applications that use both Wave Widgets and Widget Toolbox calls to produce the GUI. In this case, a resource file can be shared by all of the widgets used in the application. Note, however, that if color keywords, such as Background and Foreground, are used in a Wave Widgets call, the specified color(s) override color specifications made in a resource file.
For more information on layout widgets, see "Arranging Widgets in a Layout".
Example
Here’s a simple example showing the use of WwInit in the creation of a multi-line text widget. You can display the text widget by entering the commands as shown at the WAVE> prompt.
top=WwInit('ww_ex2', 'Examples', layout)
filename = getenv('WAVE_DIR')+ '/data/air_qual.dat'
text=WwText(layout, 'TextCB', /Read, File=filename, Cols=40, $
Rows=20)
status=WwSetValue(top, /Display)
WwLoop