WwDrawing Function
Creates a drawing area, which allows users to display graphics generated by PV‑WAVE.
Usage
wid = WwDrawing(parent, windowid, drawCallback, wsize, dsize)
Input Parameters
parent — The widget ID of the parent widget.
windowid — The window ID of the PV‑WAVE graphics window. When the window index is undefined or less than zero, the first free window index (ascending) is used and returned as windowid.
drawCallback — A string containing the name of the PV‑WAVE callback routine that is executed when the drawing area is exposed to display the graphics.
wsize — A vector containing two integers that represent the width and height of the drawing area window. The window size is limited to 32767 pixels on a side, or the available memory for the pixmap, whichever is less.
dsize — A vector containing two integers that represent the width and height of the image to be displayed in the drawing area. If this is larger than wsize, you can use the scroll bars to move the image around in the display window.
Returned Value
wid — The ID of the drawing area widget.
Keywords
Area — Returns the drawing area widget’s ID.
Border — Specifies the width of the borders in pixels for the parent widget and the child widgets. The default is 0.
Layout_name — Specifies the name of the Form or ScrolledWindow container widget used to hold the drawing area widget. The Layout_name specified is the top-level widget layout name used as part of the resource specification. (Default: drawindow
.)
Name — A string containing the name of the DrawingArea widget. The Name specified is the widget name used as part of the resource specification. (Default: draw
.)
NoMeta — (Windows only) Turns metafiles off for the window that contains the drawing area. Use this keyword when running animations or displaying images.
A metafile is an internal, vector-based record of all the graphics commands sent to a window. By default, a metafile is kept for each window to speed the redrawing of the window when it is resized. The metafile is also used when printing to avoid resolution problems that occur when printing a bitmap image.
Noscroll — If present and nonzero, the drawing area does not use scroll bars. The drawing area window is created the same size as the drawing area. In other words, the value of dsize equals wsize.
Position — If the drawing box widget is to be placed in a bulletin board layout, use this keyword to specify the x, y coordinates of the drawing box widget within the bulletin board.
Tab_WinOff — (Windows only) If this keyword is present and nonzero, the tab navigation feature is turned off for this widget.
Color Keywords
Background — Specifies the background color name.
Foreground — Specifies the foreground color name.
Attachment Keywords
Bottom — If a widget ID is specified (for example, Bottom=wid
), then the bottom of the drawing box widget is attached to the top of the specified widget. If no widget ID is specified (for example, /Bottom
), then the bottom of the drawing box widget is attached to the bottom of the parent widget.
Left — If a widget ID is specified (for example, Left=wid
), then the left side of the drawing box widget is attached to the right side of the specified widget. If no widget ID is specified (for example, /Left
), then the left side of the drawing box widget is attached to the left side of the parent widget.
Right — If a widget ID is specified (for example, Right=wid
), then the right side of the drawing box widget is attached to the left side of the specified widget. If no widget ID is specified (for example, /Right
), then the right side of the drawing box widget is attached to the right side of the parent widget.
Top — If a widget ID is specified (for example, Top=wid
), then the top of the drawing box widget is attached to the bottom of the specified widget. If no widget ID is specified (for example, /Top
), then the top of the drawing box widget will attach to the bottom of the parent widget.
Get/Set Value
getvalue — Gets the window ID of the drawing area widget.
setvalue — Sets a two-element vector containing the width and height of the drawing area.
Callback Parameters
Any drawing area widget callback procedure must have the following two parameters:
wid — Drawing area widget ID.
index — PV‑WAVE window index.
Discussion
The window size is limited to 32767 pixels on a side, or the available memory for the pixmap, whichever is less.
Example
This example creates a widget that displays an image. Whenever the drawing area widget is displayed, the callback is executed. In this case, the callback opens and reads an image file.
Enter the callback procedure into a file, and compile the procedure with the .RUN command. Then, enter the widget commands at the WAVE>
prompt. To dismiss the drawing area widget, select the appropriate function (such as Close) from the window manager menu.
PRO DrawCB, wid, data
COMMON draw, img
PRINT, 'Draw'
TV, img
END
PRO ww_ex24
top=WwInit('ww_ex24', 'Examples', layout)
COMMON draw, img
LOADCT, 5, /SILENT
img = BYTARR(512,512)
OPENR,1, !Data_Dir + 'head.img'
READU,1,img
CLOSE, 1
draw = WwDrawing(layout, 1, 'DrawCB', [256,256], [512,512])
status = WwSetValue(top, /Display)
WwLoop
END
See Also
For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.
For more information about how to write an application program based on PV‑WAVE Widgets, refer to Using Wave Widgets in the PV‑WAVE Application Developer’s Guide.
For additional information on the color and font keywords, see "Setting Colors and Fonts" in the PV‑WAVE Application Developer’s Guide.
For additional information on attachment keywords, see "Form Layout: Attachments" in the PV‑WAVE Application Developer’s Guide.
For information on Get and Set values, see "Setting and Getting Widget Values" in the PV‑WAVE Application Developer’s Guide.