AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
Frame typedict
 
A Frame represents a top-level application window that is implemented using Java's AWT Frame class. A frame consumes system resources that are currently only returned after the frame is explicitly disposed, which happens when your program stores a non-zero value in the frame's dispose field. Yoix programs normally interact with a Frame using event handlers and by reading or writing the following fields:
autodeiconify An int that arranges to deiconify the frame, exactly as if a zero value had been stored in the iconified field, whenever the frame is made visible by storing a non-zero value in the frame's visible field while autodeiconify is non-zero (the default).
autodispose An int that arranges to dispose the frame, exactly as if a non-zero value had been stored in the dispose field, whenever a visible frame is hidden while autodispose is non-zero. Failure to dispose of unused frames means system resources are lost, and that can eventually affect the performance of your program.
autoraise An int that automatically puts the frame on top of all other windows whenever a non-zero value is stored in the frame's visible field.
background The Color that is used to paint the background of the frame. It is also the default background color assigned to components in the layout array that do not pick their own. A frame that does not set its own background color uses VM.screen.background. Reading returns a snapshot of the current color. Writing immediately sets the frame's background, and the background of components contained in the frame that do not pick their own, to the new color.
backgroundhints An int that controls how backgroundimage is displayed in the frame. The value should be one of SCALE_AREA, SCALE_DEFAULT, SCALE_FAST, SCALE_NONE, SCALE_REPLICATE, SCALE_SMOOTH, or SCALE_TILE, which are all defined in yoix.image. SCALE_NONE places the unscaled image in the upper left corner of the frame, while SCALE_TILE (the default) tiles the entire frame with the unscaled image. The other values select the algorithm used to scale backgroundimage so it fills the entire frame. Reading returns the current hints. Writing immediately repaints the frame using the new hints to display the background image.
backgroundimage An Object that should be an Image or String that identifies an image that is automatically displayed as part of the frame's background in a way that is controlled by the value assigned to backgroundhints. A NULL value, which is the default, means there is no image. A backgroundimage that is a String should name a local a file or URL that contains a GIF or JPEG image. Reading returns the current image. Writing immediately repaints the frame using the new image.
components A Dictionary maintained by the interpreter's layout machinery that maps tag fields to actual components; every component contained in the frame has an entry in the dictionary. In addition, the root field in each component is automatically set to the frame, so the components dictionary is easy to find, and that means individual components can find each other by name using the root.components dictionary.
cursor An Object that should be an int, Image, or String that selects the cursor shown when the pointer is over the frame. It is also the default cursor assigned to components in the frame's layout array that do not pick their own. A cursor that is an int should be one of the cursors defined in the yoix.awt.Cursor dictionary. A cursor that is an Image can describe the cursor using its size and hotspot fields and often draws it using its paint function. A cursor that is a String should be the name of a cursor that is already defined in yoix.awt.Cursor or the name a local a file or URL that contains a GIF or JPEG image that will be used as the cursor.

Reading returns the current cursor. Writing immediately sets the frame's cursor, and the cursor of components contained in the frame that do not pick their own, to the new value. A frame that does not set its own cursor uses DEFAULT_CURSOR.

dispose An int that is 1 when the frame has been properly disposed and 0 otherwise. Reading returns the current dispose state. Writing a non-zero value immediately disposes the frame; writing 0 has no effect, which means you cannot resurrect a disposed frame. Failure to dispose of unused frames means system resources are lost, and that can eventually affect the performance of your program.
enabled An int that is 1 when the frame, or any of the components contained in the frame, can respond to user input, and 0 when they can not. Reading returns the current state. Writing immediately sets the frame's state to the new value.
focusowner A read-only int that is non-zero when the frame has the focus.
font The Font, or font name if it is a String, that is used as the default font assigned to components in the layout array that do not pick their own. Reading returns a snapshot of the current font. Writing immediately changes the frame's font, and the font used by all components contained in the frame that do not pick their own, to the new font.
foreground The Color that is used as the default foreground color assigned to components in the layout array that do not pick their own. A frame that does not set its own foreground color uses VM.screen.foreground. Reading returns a snapshot of the current color. Writing immediately sets the frame's foreground, and the foreground of components contained in the frame that do not pick their own, to the new color.
fronttoback An int that is 1 when components that appear earlier in the layout array are placed on top of components that appear later, and 0 when the stacking order is reversed. In practice, GridBagLayout and CardLayout are only layout managers where stacking components makes sense. Reading returns the current stacking order. Writing immediately tries to change the stacking order.
graphics A Graphics object that defines properties and built-ins that are used to apply graphics operations to this frame. Writing after a frame has been created is not allowed and will result in an invalidaccess error.
iconified An int that is 1 when the frame has been iconified, and 0 otherwise. Reading returns the current iconified state. Writing immediately sets the frames's iconified state to the new value.
layout An Array of objects, often just components, that the layoutmanager arranges in the frame. Reading returns the current array. Writing immediately clears frame and then arranges the new set of components in the frame.
layoutmanager A LayoutManager that takes components from the layout array, arranges them in the frame, updates the frame's components dictionary, and makes sure the root field in each component is set to the frame. Reading returns the current layout manager. Writing, when validate is non-zero, immediately clears the frame and then rearranges the components in the layout array using the new layout manager. Yoix frames use a BorderLayout as their default layout manager.
location A Point that determines the location of the frame's upper left corner in the default Yoix coordinate system, which has its origin at the upper left corner of the screen, positive x to the right, positive y down, and a resolution of 72 dots per inch. Reading returns a snapshot of the current location. Writing immediately moves the frame to the new location.
maximized An int that is 1 when the frame has been maximized, and 0 otherwise. Reading returns the current maximized state. Writing immediately sets the frame's maximized state to the new value.
menubar A MenuBar that is attached to the frame. Reading returns the current menubar. Writing immediately removes the current menubar, if there is one and it is different than the new one, and attaches the new menubar.
nextcard An Object that CardLayout layout managers use to pick the next component that is displayed in the frame. See the description of CardLayout for more details.
paint([Rectangle rect]) A Function that is called, if it is not NULL, whenever the frame needs to be painted. The optional rect argument describes the rectangle that needs repainting in the coordinate system specified by graphics.CTM, which by default has its origin at the frame's upper left corner, positive x to the right, positive y down, and a resolution of 72 dots per inch.
parent A window, which usually should be a Frame, Dialog, FileDialog, or Window, that is responsible for the frame. Hiding, disposing, iconifying or deiconifying the parent does the same thing to its children, so using a parent is a convenient way to manage a group of windows. Reading returns the current parent. Writing immediately sets the frame's parent to the new value.
popup A PopupMenu that is associated with the frame. Reading returns the current popup menu. Writing immediately shows the popup menu at the point in the frame's coordinate system specified by the popup menu's location field, assuming of course that the frame is showing on the screen. Storing TRUE in the popup menu's visible field, which was added in release 1.2.0, is an easy way to show the popup menu that currently belongs to the frame.
repaint() A Builtin that tells the frame to completely repaint itself, which means the background is regenerated and then the frame's paint function is called. Obviously repaint should not be called, either directly or indirectly, from the frame's paint function, however erasedrawable is safe because it does not trigger a paint call.
requestfocus An int that can be used to request or transfer the keyboard focus. Storing a non-zero value in requestfocus tries to get the focus. Storing 0 tries to transfer the focus. Reading requestfocus does not currently return any useful information.
resizable An int that is 1 (the default) when the frame can be resized by user actions, and 0 when its size is fixed.
root A read-only field that for convenience always points to the frame itself.
showing A read-only int that is non-zero when the frame is showing on the screen. Reading showing or visible produce identical results for a top-level container like a frame.
size A Dimension that determines the size of the frame in units of 72 dots per inch. Reading returns a snapshot of the current size. Writing immediately changes the frame's size to the new value. Setting size to NULL means the layoutmanager determines the size of the frame based on the preferred size of the components in the layout array.
tag A String used to identify the frame that is either supplied when the frame is declared, or automatically generated otherwise. Frames are top-level containers, so the tag field is not particularly useful and may be deleted in future releases.
title A String that is used as the frame's title. Reading returns a snapshot of the current title. Writing immediately changes the title to the new value.
validate An int that is 1 when changing the layoutmanager field takes effect immediately, and 0 when the change is delayed, often until after the layout, size, or validate fields change. Storing a 1 in validate always runs Java's layout manager, even when nothing has changed.
visible An int that is 1 when the frame is visible, and 0 otherwise. Reading returns the current visibility. Writing immediately sets the frame's visibility to the new state.
Several permanent fields have not been documented and should not be used in Yoix applications. Event handlers are functions that must be added to a frame when it is declared. The handlers that work with frames are listed below; the names should be familiar if you have done some Java programming. The actionPerformed and itemStateChanged event handlers are only for menus.
 
 Event Handlers:   actionPerformed, componentHidden, componentMoved, componentResized, componentShown, dragDropEnd, dragEnter, dragExit, dragGestureRecognized, dragMouseMoved, dragOver, drop, dropActionChanged, focusGained, focusLost, invocationRun, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
 Example:   The program,
import yoix.*.*;

Frame main = {
    String title = "Parent";

    Array layout = {
        new Button {
            String text = "Show Child";
            actionPerformed(e) {
                child.visible = TRUE;
            }
        }, CENTER,

        new Button {
            String text = "Exit";
            actionPerformed(e) {
                exit(0);
            }
        }, SOUTH,
    };
};

Frame child = {
    String    title = "Child";
    Frame     parent = main;
    String    font = "Courier-bold-16";
    Dimension size = NULL;

    Array layout = {
        new Button {
            String text = "HIDE THIS BUTTON";
            actionPerformed(e) {
                root.visible = FALSE;
            }
        }
    };

    windowOpened(e) {
        Point     location = parent.location;
        Dimension size = parent.size;

        location.x += (size.width - this.size.width)/2;
        location.y += (size.height - this.size.height)/2;
        this.location = location;
    }
};

main.visible = TRUE;
shows how to use some of the fields in a frame, including how how to make one frame a child of another. Try iconifying the parent frame when the parent and child are both visible.
 
 See Also:   BorderLayout, Button, Canvas, CardLayout, Checkbox, Choice, CustomLayout, Dialog, FileDialog, FlowLayout, GridBagLayout, GridLayout, Image, Label, List, Menu, MenuBar, Panel, PopupMenu, postEvent, printAll, ScrollPane, Scrollbar, TableColumn, TableManager, TextArea, TextCanvas, TextField, TextTerm, toBack, toFront, Window

 

Yoix is a registered trademark of AT&T Intellectual Property.