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
FileDialog typedict
 
A FileDialog represents a top-level application window that is implemented using Java's AWT FileDialog class. A filedialog consumes system resources that are currently only returned after the filedialog is explicitly disposed, which happens when your program stores a non-zero value in the filedialog's dispose field. Filedialogs are a platform dependent tool that lets users browse though a file system and select at most one file that is supposed to be read or written. Yoix programs normally interact with a FileDialog using event handlers and by reading or writing the following fields:
autodispose An int that arranges to dispose the filedialog, exactly as if a non-zero value had been stored in the dispose field, whenever a visible filedialog is hidden while autodispose is non-zero. Failure to dispose of unused filedialogs means system resources are lost, and that can eventually affect the performance of your program.
background The Color that is used to paint the background of the filedialog. Reading returns a snapshot of the current color. Writing is not allowed and will result in an invalidaccess error.
directory A String that names the directory where the filedialog looks for files. When the filedialog is made visible it always starts looking for files in the directory that was last stored in the directory field. Reading returns the directory where the last file was found, or the current starting directory if no file was selected. Writing changes the starting directory that is used the next time the filedialog is made visible.
dispose An int that is 1 when the filedialog has been properly disposed and 0 otherwise. Reading returns the current dispose state. Writing a non-zero value immediately disposes the filedialog; writing 0 has no effect, which means you cannot resurrect a disposed filedialog. Failure to dispose of unused filedialogs means system resources are lost, and that can eventually affect the performance of your program.
enabled An int that is 1 when the filedialog can respond to user input, and 0 when it can not. Reading returns the current state. Writing immediately sets the filedialog's state to the new value.
file A String that names the file selected by the filedialog. When the filedialog is made visible the starting value is the last name that was stored in the file field. Reading returns the last selected file, or NULL if no file was selected, usually because the Cancel button was pushed. Writing changes the starting file that is used the next time the filedialog is made visible.
font The Font that is used by the filedialog. Reading returns a snapshot of the current font. Writing is not allowed and will result in an invalidaccess error.
foreground The Color that is used to paint the foreground of the filedialog. Reading returns a snapshot of the current color. Writing is not allowed and will result in an invalidaccess error.
layoutmanager A LayoutManager that is permanently set to NULL, because filedialogs take complete responsibility for their own layout. Writing is not allowed and will result in an invalidaccess error.
location A Point that is permanently set to NULL, because Java's FileDialog class does not seem to respond to requests that should move the filedialog. Writing is not allowed and will result in an invalidaccess error.
mode An int that should be OPEN (the default) or LOAD when the selected file will be read and SAVE when it will be written. All three constants are defined in yoix.awt. Reading returns the current mode. Writing changes the filedialog's mode, which may also change its appearance the next time it is made visible.
parent A window, which usually should be a Frame, Dialog, FileDialog, or Window, 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 filedialog's parent to the new value.
root A read-only field that for convenience always points to the filedialog itself. A filedialog is top-level container with a fixed layoutmanager that that is completely responsible fot its own layout, so the root field is not particularly useful.
showing A read-only int that is non-zero when the filedialog is showing on the screen. Reading showing or visible produce identical results for a top-level container like a filedialog.
size A Dimension that is permanently set to NULL, because Java's FileDialog class does not seem to respond to requests that should resize the filedialog. Writing is not allowed and will result in an invalidaccess error.
tag A String used to identify the filedialog that is either supplied when the filedialog is declared, or automatically generated otherwise. Filedialogs are top-level containers, so the tag field is not particularly useful and may be deleted in future releases.
toyoixpath An int that controls what happens to platform dependent file separators when the file and directory fields are read. When toyoixpath is non-zero all file separators are replaced by the slash character /, otherwise no changes are made.
visible An int that is 1 when the filedialog is visible, and 0 otherwise. Reading returns the current visibility. Writing immediately sets the filedialog'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 filedialog when it is declared. The handlers that work with filedialogs are listed below; the names should be familiar if you have done some Java programming. We have not listed any DragGestureEvent, DragSourceEvent, DropTargetEvent, FocusEvent, KeyEvent, or MouseEvent handlers because the experiments that we ran were either unsuccessful or inconsistent.

A filedialog completely blocks the rest of your application while it is visible. After its dismissed, the full pathname of the selected file is obtained by concatenating the directory and file fields; the style of that pathname is controlled by the toyoixpath field.
 
 Event Handlers:   componentHidden, componentMoved, componentResized, componentShown, invocationRun, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
 Example:   The program,
import yoix.*.*;

FileDialog fd = {
    String directory = VM.tmpdir;
    int    mode = SAVE;
};

fd.visible = TRUE;

if (fd.file != NULL)
    printf("You selected: %s%s\n", fd.directory, fd.file);
else printf("You made no selection\n");
shows a filedialog that starts in your system's temp directory. Pick a file and the full pathname should print on standard output; hit the Cancel button and you should see
You made no selection
on standard output.
 
 See Also:   Button, Canvas, Checkbox, Choice, Dialog, Frame, Label, List, Panel, postEvent, ScrollPane, Scrollbar, TableColumn, TableManager, TextArea, TextCanvas, TextField, TextTerm, Window, yoixPath

 

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