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
ComponentEvent typedict
 
A ComponentEvent is a low level event that indicates a component has been hidden, moved, resized, or shown. The only field in a ComponentEvent is:
id An Object that must be an int or String, that identifies the type of this event. A value that is a String must be the name of an event handler that can process this event. A value that is an int must be a number that the yoix.event.HandlerID dictionary associates with an event handler that can process this event.

In practice, id is only used when you build an event that gets handed to postEvent, and in that case the value assigned to id is almost always a String.

Most components can receive ComponentEvents, but they only arrive if the component has defined one or more of the event handlers listed below.
 
 Event Handlers:   componentHidden, componentMoved, componentResized, componentShown
 
 Example:   The program,
import yoix.*.*;

JFrame frame = {
    componentHidden(Event e) {
        puts("Received componentHidden");
    }

    componentMoved(Event e) {
        puts("Received componentMoved");
    }
};

frame.visible = TRUE;
sleep(2);

ComponentEvent event = {
    String id = "componentMoved";
};

printf("Posting %s\n", event.id);
postEvent(event, frame);
sleep(2);
frame.visible = FALSE;
sleep(2);
prints something like
Posting componentMoved
Received componentMoved
Received componentHidden
on standard output. The first componentMoved event is a real one, and happens when the frame is made visible for the first time.
 
 See Also:   ActionEvent, AdjustmentEvent, CaretEvent, ChangeEvent, DragGestureEvent, DragSourceEvent, DropTargetEvent, Event, FocusEvent, HyperlinkEvent, InvocationEvent, invokeLater, isDispatchThread, ItemEvent, KeyEvent, ListSelectionEvent, MouseEvent, MouseWheelEvent, PaintEvent, postEvent, TextEvent, TreeSelectionEvent, WindowEvent

 

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