"Fossies" - the Fresh Open Source Software archive

Member "jacl1.4.1/docs/TclJava/JavaEventCmd.html" of archive jacl1.4.1.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. Alternatively you can here view or download the uninterpreted source code. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.


The java::event Command


Usage:

java::event ?-index num? ?propertyName?

When a callback script is invoked due to the firing of a Java event, some event parameters may be passed to the script to give detailed description of the event. The java::event command is used to query the values of these parameters. The -index option specifies which event parameter to quety: num is equal to 0 for the first parameter, 1 for the second parameter, and so on. If the -index option is omitted, the first event paramater is queried by default. In most cases, there is exactly one event parameter passed to the callback script and the -index may thus be safely omitted.

If propertyName is not given, java::event returns the value of the specified event paramater. If the specified event parameter is a Java object, then its object handle is returned. If propertyName is given, and the specified event parameter is a Java object, java::event returns the value of the given property of the event parameter. The second form is used mainly for convenience. For example, the following two statements are equivalent:

java::bind $b keyTyped {
    puts [java::prop [java::event] keyCode]
}

java::bind $b keyTyped {
    puts [java::event keyCode]
}

Event handling may be nested if the Tcl event loop is re-entered during the execution of a callback script (e.g, when a callback script executes the update command.) In that case, java::event always returns the paramaters of the inner-most event whose callback script is currently being executed.

If the eventName and script arguments are both omitted, the java::bind command returns a Tcl list of the the full names of all the events of javaObj that are currently associated with callback scripts.

Copyright © 1997-1998 Sun Microsystems, Inc.