"Fossies" - the Fresh Open Source Software archive

Member "jacl1.4.1/docs/TclJava/JavaEventCmd.html" (8 May 1999, 2161 Bytes) of archive /linux/misc/jacl1.4.1.tar.gz:


The java::event Command


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.