WwLayout Function
Creates a layout widget that is used to control the arrangement of other widgets.
Usage
layout = WwLayout(parent)
Input Parameters
parent — The widget ID of the parent widget.
Returned Value
layout — The widget ID of the layout widget.
Keywords
Board — If present and nonzero, the layout that is created is a “bulletin board”.
Border — Specifies the width of the borders in pixels for the parent widget and the child widgets. The default is 0.
Form — If present and nonzero, a form layout is created.
Frame — If nonzero, creates a frame widget with a layout child and returns the widget ID for the layout.
Horizontal — If present and nonzero, aligns child widgets horizontally within the layout widget (the default). This keyword is only used for row/column layouts.
Layout_name — Specifies the name of the layout widget used as part of the resource specification. Layout_name names the Form widget (when used with Form), the RowColumn widget (when used with Horizontal and/or Vertical), the ScrolledWindow widget (when used with Scroll), or the BulletinBoard widget (when used with Board). (Default: layout.)
Name — A string specifying the name of the frame widget created using the Frame keyword. The frame widget name specified is part of the resource specification. (Default: frame.)
Position — If the layout widget is to be placed in a bulletin board layout, use this keyword to specify the x, y coordinates of the layout widget within the bulletin board.
Scroll — If present and nonzero, places scroll bars on the layout widget. Specify a width and height (e.g., Scroll=[w,h]) to set the width and height of the scrolled window.
Spacing — Specifies amount of space in pixels between child widgets in the layout. Default is 0. This keyword is only used for row/column layouts.
Vertical — If present and nonzero, aligns child widgets vertically within the parent widget. This keyword is only used for row/column layouts.
Color/Font 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 layout widget is attached to the top of the specified widget. If no widget ID is specified (for example, /Bottom), then the bottom of the layout 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 layout 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 layout 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 layout 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 layout 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 layout widget is attached to the bottom of the specified widget. If no widget ID is specified (for example, /Top), then the top of the layout widget is attached to the top of the parent widget.
Get/Set Value
getvalue — Gets the x, y position of the contents of the scrolled window.
setvalue — Sets the x, y position of the contents of the scrolled window.
Callback Parameters
None.
Discussion
The Board, Form, Vertical, Horizontal, and Scroll keywords are mutually exclusive: you can only use one of them at a time.
A layout widget is a container that holds other widgets. The layout widget provides different methods of arranging widgets, such as buttons, menus, sliders, and even other layout widgets, inside the “container.” The three layout types are:
Row/column — Widgets are arranged in rows and/or columns (the default).
Form — Widgets are “attached” to one another inside the layout. Specified with the
Form keyword.
Bulletin board — Widgets are positioned in the layout with
x,
y coordinates. Specified with the
Board keyword.
The layout widget can be the parent widget for each “child” widget it contains. If a border is not specified with the Border keyword, the layout widget itself is not visible to the user; only the widgets inside the layout are visible.
For more detailed information on layouts, see "Arranging Widgets in a Layout" in the PV‑WAVE Application Developer’s Guide.
Example
The following example creates a simple layout widget (widget_layout) that contains two additional layout widgets (leftlayout and rightlayout). The leftlayout widget contains three buttons and the rightlayout widget contains two drawing areas. Note that WwLayout does not use callbacks, as it primarly creates a "container" that holds other widgets.
By default, layout widgets are arranged in rows and/or columns. But in this example, it shows the use of a Form layout where the widgets are attached to one another with the bottom, left, right and top keywords.
Enter the callback procedures and main procedure into a file, and compile them with the .RUN command. Then, enter wwlayout_ex at the WAVE> prompt. To dismiss the layout box, select the appropriate function (such as Close) from the window manager menu.
PRO NullCB, wid, which
END
PRO ButtonCB, wid, which
value= WwGetValue(wid)
PRINT, 'Button ' + value + ' is contained in ' + $
'the leftlayout widget.'
END
PRO wwlayout_ex
top = WwInit('ww_ex27', 'wwlayout_ex', layout, /Form)
widget_layout = WwLayout(layout, /Form, /Top, /Bottom, $
/Left, /Right)
leftlayout = WwLayout(widget_layout, /Left, /Top, /Bottom, $
/Vertical)
rightlayout = WwLayout(widget_layout, /Right, /Top, $
/Bottom, Left = leftlayout, /Vertical)
bbox = WwButtonBox(leftlayout, ['One', 'Two', 'Three'], $
'ButtonCB', /Vertical)
drawarea1 = WwDrawing(rightlayout, wid1, 'NullCB', $
[400, 400], [400, 400], /Top, /Right)
drawarea2=WwDrawing(rightlayout, wid2, 'NullCB', [400, 400],$
[400, 400], Top = drawarea1, /Right, /Bottom, /NoScroll)
status = WwSetValue(top, /Display)
WwLoop
END
See Also
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.