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

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
Dialog typedict
 
A Dialog represents a top-level application window that is implemented using Java's AWT Dialog class. A dialog consumes system resources that are currently only returned after the dialog is explicitly disposed, which happens when your program stores a non-zero value in the dialog's dispose field. Yoix programs normally interact with a Dialog using event handlers and by reading or writing the following fields:
autodispose An int that arranges to dispose the dialog, exactly as if a non-zero value had been stored in the dispose field, whenever a visible dialog is hidden while autodispose is non-zero. Failure to dispose of unused dialogs means system resources are lost, and that can eventually affect the performance of your program.
autoraise An int that automatically puts the dialog on top of all other windows whenever a non-zero value is stored in the dialog's visible field.
background The Color that is used to paint the background of the dialog. It is also the default background color assigned to components in the layout array that do not pick their own. A dialog that does not set its own background color uses VM.screenbackground. Reading returns a snapshot of the current color. Writing immediately sets the dialog's background, and the background of components contained in the dialog that do not pick their own, to the new color.
backgroundhints An int that controls how backgroundimage is displayed in the dialog. 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 dialog, while SCALE_TILE (the default) tiles the entire dialog with the unscaled image. The other values select the algorithm used to scale backgroundimage so it fills the entire dialog. Reading returns the current hints. Writing immediately repaints the dialog 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 dialog'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 dialog 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 dialog has an entry in the dictionary. In addition, the root field in each component is automatically set to the dialog, 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 dialog. It is also the default cursor assigned to components in the dialog'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 dialog's cursor, and the cursor of components contained in the dialog that do not pick their own, to the new value. A dialog that does not set its own cursor uses DEFAULT_CURSOR.

dispose An int that is 1 when the dialog has been properly disposed and 0 otherwise. Reading returns the current dispose state. Writing a non-zero value immediately disposes the dialog; writing 0 has no effect, which means you cannot resurrect a disposed dialog. Failure to dispose of unused dialogs means system resources are lost, and that can eventually affect the performance of your program.
enabled An int that is 1 when the dialog, or any of the components contained in the dialog, can respond to user input, and 0 when they can not. Reading returns the current state. Writing immediately sets the dialog's state to the new value.
focusowner A read-only int that is non-zero when the dialog 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 dialog's font, and the font used by all components contained in the dialog 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 dialog that does not set its own foreground color uses VM.screen.foreground. Reading returns a snapshot of the current color. Writing immediately sets the dialog's foreground, and the foreground of components contained in the dialog 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 dialog. Writing after a dialog has been created is not allowed and will result in an invalidaccess error.
layout An Array of objects, often just components, that the layoutmanager arranges in the dialog. Reading returns the current array. Writing immediately clears dialog and then arranges the new set of components in the dialog.
layoutmanager A LayoutManager that takes components from the layout array, arranges them in the dialog, updates the dialog's components dictionary, and makes sure the root field in each component is set to the dialog. Reading returns the current layout manager. Writing, when validate is non-zero, immediately clears the dialog and then rearranges the components in the layout array using the new layout manager. Yoix dialogs use a BorderLayout as their default layout manager.
location A Point that determines the location of the dialog'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 dialog to the new location.
modal An int that is 1 when the dialog must be dismissed (i.e., either hidden or disposed) before any user input will go to other windows, and 0 otherwise. Writing after a dialog has been created is not allowed and will result in an invalidaccess error.
nextcard An Object that CardLayout layout managers use to pick the next component that is displayed in the dialog. See the description of CardLayout for more details.
paint([Rectangle rect]) A Function that is called, if it is not NULL, whenever the dialog 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 dialog'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 dialog. 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 dialog's parent to the new value.
popup A PopupMenu that is associated with the dialog. Reading returns the current popup menu. Writing immediately shows the popup menu at the point in the dialog's coordinate system specified by the popup menu's location field, assuming of course that the dialog 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 dialog.
repaint() A Builtin that tells the dialog to completely repaint itself, which means the background is regenerated and then the dialog's paint function is called. Obviously repaint should not be called, either directly or indirectly, from the dialog'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 dialog 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 dialog itself.
showing A read-only int that is non-zero when the dialog is showing on the screen. Reading showing or visible produce identical results for a top-level container like a dialog.
size A Dimension that determines the size of the dialog in units of 72 dots per inch. Reading returns a snapshot of the current size. Writing immediately changes the dialog's size to the new value. Setting size to NULL means the layoutmanager determines the size of the dialog based on the preferred size of the components in the layout array.
tag A String used to identify the dialog that is either supplied when the dialog is declared, or automatically generated otherwise. Dialogs 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 dialog'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 dialog is visible, and 0 otherwise. Reading returns the current visibility. Writing immediately sets the dialog'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 dialog when it is declared. The handlers that work with dialogs 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.*.*;

Dialog d = {
    int modal = 1;

    Array layout = {
        new Label {
            String text = "THIS IS A MODAL DIALOG";
            Color  background = Color.white;
            int    alignment = CENTER;
        }, CENTER,

        new Panel {
            Array layout = {
                new Button {
                    String text = "Dismiss";

                    actionPerformed(e) {
                        root.visible = FALSE;
                    }
                },
            };
        }, SOUTH,
    };
};

d.visible = TRUE;
printf("Exiting\n");
prints
Exiting
on standard output, but only after the dismiss button in the dialog is pressed.
 
 See Also:   BorderLayout, Button, Canvas, CardLayout, Checkbox, Choice, CustomLayout, FileDialog, FlowLayout, Frame, GridBagLayout, GridLayout, Image, Label, List, Menu, MenuBar, Panel, PopupMenu, postEvent, ScrollPane, Scrollbar, TableColumn, TableManager, TextArea, TextCanvas, TextField, TextTerm, toBack, toFront, Window

 

Yoix is a registered trademark of AT&T Inc.