A Window object represents a resizable window. The Window class is a subclass of WindowPanel, which itself is a subclass of BaseWindow. BaseWindow is a direct child of BaseComponent. The class hierarchy is shown in Figure 2.6.
Tables 2.4, 2.5, and 2.6 present the attributes of the BaseWindow class, WindowPanel class, and Window class, respectively.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
datacontrolsvisibility | Tag only | boolean | false | final |
Description. Indicates if the datapath associated with this window will cause the window to be invisible if it matches no data or visible if it matches data. | ||||
haswindowfocus | Tag and JS | boolean | false | read-write |
Description. Indicates if this window has the focus. | ||||
minheight | Tag only | number | 50 | final |
Description. The minimum height of this window in pixels. | ||||
minwidth | Tag only | number | 60 | final |
Description. The minimum width of this window in pixels. | ||||
state | Tag and JS | number | 1 | read-only |
Description. The stat of this window. The value is one of these: 1 (selected), 2 (not selected), 3 (dragging), 4 (disabled), and 5 (resizing). |
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
closeable | Tag and JS | boolean | false | read-write |
Description. Indicates if this window panel can be closed. | ||||
inset_bottom | Tag and JS | number | 20 | read-write |
Description. The bottom inset for the content area in pixel. | ||||
inset_left | Tag and JS | number | 6 | read-write |
Description. The left inset for the content area in pixel. | ||||
inset_right | Tag and JS | number | 11 | read-write |
Description. The right inset for the content area in pixel. | ||||
inset_top | Tag and JS | number | 22 | read-write |
Description. The top inset for the content area in pixel. | ||||
title | Tag and JS | string | read-write | |
Description. The title of this window panel. | ||||
titlearea_inset_top | Tag and JS | number | 6 | read-write |
Description. The top inset for the window title area in pixel. |
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
resizable | Tag and JS | boolean | false | read-write |
Description. Indicates if this window can be resized. A resizable window has a handle it its lower-right corner that the user can drag to resize the window. |
The BaseWindow class adds three methods:
close()
Hides the window, the same as setting the visible attribute to false.
open()
Shows the window, the same as setting the visible attribute to true.
setVisible(visible)
Sets the visible attribute.
The WindowPanel and Window classes do not add new methods.
The windowTest1.lzx file in Listing 2.6 features an LZX application that displays a resizable window.
<canvas height="200" width="400"> <window resizable="true" width="200" height="200"> <text>OpenLaszlo is cool!</text> </window> </canvas> |
You can invoke the LZX application using this URL:
http://localhost:8080/lps-4.0.x/app02/windowTest1.lzx
The generated output is shown in Figure 2.7.
You can resize the window by dragging the arrow at the right bottom corner. You can also draw the window around the canvas. If the window is nested inside a container, such as a view, the window can move beyond the container.