| Water Contract<class ui.pane.window
name =opt=string
_other_unkeyed=opt=<type.one_of ui null/>="_other_unkeyed"
_other_unkeyed=opt=<type.one_of ui null/>="_other_unkeyed"
/> | |
See also: ui, pane, item, remove_all_windows
Windows are top level panes. Other panes and items are contained in windows.
Windows themselves have an invisible container which is the ui class itself.
Window is implemented using the java_swing.JFrame class.
The window class lives in thing.ui.pane.window, though an additional
pointer to it lives in the ui class so that you can access it via the shorter:
ui.window. Note using wob as the first part for the path is legal,
and explicit but unnecessary.
ui.<window name="mywin"/> <!-- create a window named mywin -->
ui.pane.window <!-- alternative way to get the window class. -->
ui.mywin <!-- get the instance of window named mywin -->
Like other components, windows also have an 'index' created for them in their container.
ui.<length/> <!-- number of active windows -->
ui.0 <!-- first window. If our only window is mywin, this is the same as ui.mywin -->
ui.<for_each include=vector_key combiner=insert>
value.name
</for_each> <!-- returns a vector of the names of all windows. -->
Windows have 'property' fields just like other components such as their size and
position. See the doc for 'ui' for examples on getting and setting x, y, width, and height.
The content of a window contains the parts of a window, just as for other panes.
A window may have two parts, a menubar and a center.
The first expression in the content of a call to window is used as the menubar.
It should be an object of type menubar.
The second expression is the 'center' or main content of the window.
This can be any component such as a button but is more typically a pane
such as a row or column that contains other components.
If you want to initialize a window to just have a center, use null as
a placeholder for the menubar.
ui.<window/>
ui.<window name="mywin" x=100 y=30 width=200 height=300/>
ui.<window name="mywin">
ui.<menubar>
ui.<menu name="File">
ui.<menuitem name="Open" click=<method null> <echo "should open file"/></>/>
</menu>
ui.<menu name="Edit"/>
</menubar>
</window> ui.<window name="mywin">
null
ui.<row> ui.<button name="button1"/> ui.<button name="button2"/> </row>
</window>
ui.<window name="mywin">
ui.<menubar> ui.<menu name="mymenu"/> </menubar>
ui.<row> ui.<button name="button1"/> ui.<button name="button2"/> </row>
</window>
menubar and center are "logical names" for the components that are
assigned to them. In addition to using the component names and their indexes
within their container, you can also use the logical names to reference
a component.
ui.mywin.menubar <!-- returns the menubar component -->
ui.mywin.0 <!-- also returns the menubar component -->
ui.mywin.center <!-- returns whatever component is in the center of the window -->
ui.mywin.1 <!-- also returns the center component -->
Note that the class of the component that is the menubar part is also 'menubar'.
Usually there's no relationship between the logical name and the class of
the part. menubars in windows are special in this regard.
Logical names can be used to set and remove components from their containers
as well.
ui.<window name="mywin"> ui.<menubar> ui.<menu label="file"/></> </window>
ui.mywin.menubar <!-- returns the menubar inside of mywin -->
ui.mywin.<remove "menubar"/>
ui.mywin.menubar <!-- returns the menubar class inside of ui.pane since
there no longer is the actual menubar instance in
mywin -->
ui.mywin.<set menubar=ui.<menubar> ui.<menu label="edit"/> </menubar>/>
ui.mywin.menubar <!-- returns the new menubar inside of mywin -->© Copyright 2007 Clear Methods, Inc.