WtCreate Function (Motif Only)
Creates a widget or shell instance specified by widget class.
Usage
widget = WtCreate(name, class, parent[, argv])
Parameters
name — A string containing the name of the widget or shell to be created.
class — A constant value specifying the widget or shell class (long). See Appendix A: Motif Widget Classes in the PV‑WAVE Application Developer’s Guide for a list of Motif widget classes.
parent — The widget or shell ID of the parent (long).
argv — A structure that contains the arguments or resources for the widget or shell.
Returned Value
widget — A newly created widget. If the function fails, zero (0) is returned.
Keywords
ConfirmClose — A string containing the name of the procedure called when the user selects the Close or Quit menu button from the window manager menu.
UserData — A variable. If the ConfirmClose keyword is specified, the value of this variable is passed to the Close or Quit callback procedure.
Discussion
The ConfirmClose keyword lets you control what happens when the user selects Close or Quit from the window manager menu. Normally, the window from which the menu item was selected is destroyed; however, you might want to display a confirmation dialog box or take another action instead of simply allowing the window to be destroyed. The callback procedure specified by ConfirmClose destroys the window when appropriate.
The ConfirmClose procedure you specify accepts two parameters: wid and user_data, where:
wid — The widget ID of the top-level shell of the application.
user_data — The variable specified via the User_Data keyword. If User_Data is not specified, 0 (zero) is passed to the ConfirmClose routine.
If specified, your ConfirmClose routine must close the top-level shell of the application. An example of a simple ConfirmClose routine which just closes the shell is:
PRO MyConfirmClose, wid, user_data
s = WwSetValue(wid, /Close)
END
If ConfirmClose is not specified, then the shell is simply closed.
Example
items=REPLICATE({FLATNON,label:'', mnemonic:''},3)
items(0)={FLATNON,'Bold','B'}
items(1)={FLATNON,'Italic','I'}
items(2)={FLATNON,'Underline','U'}
fargs = {,items:items}
widget=WtCreate('fnon', $
flatNonexclusivesWidgetClass, parent, fargs)
Note: |
All widgets are managed when created. To unmanage them after creation use WtSet(wid,/Unmanage). |
See Also
For more information about how to write an application program based on the PV‑WAVE Widget Toolbox, refer to Using the Widget Toolbox in the PV‑WAVE Application Developer’s Guide.