setpoint [x y [window_id]
where x and y are screen coordinates and window_id is the identifying number for a layout window.
The setpoint command forces the reference point for a specific window. Each command that executes relative to a window must be able to translate from the pointer position to a layout coordinate. Commands that are executed from a script or from the command-line may not have access to the pointer, but can set the reference point with this command so that the effect of the command is predictable.
Normally, in interactive this command is not used. However, scripts that open more than one window need to specify which one is to take the action of the command. In the Tcl/Tk version, this can be done by using the tk_path_name command to pass a command to a specific window. The non-Tcl/Tk version, and the Tcl/Tk version using the "-dnull" option on the command line (i.e., no graphics package initialized) must use the setpoint command to track windows. Although possible, it is generally a bad idea for a script running in batch mode ("-dnull") to create and access multiple windows, since the window structures have no useful function outside of a graphics environment. Nevertheless, it is important to realize that the openwindow command will generate multiple virtual windows in a batch-mode environment, and these can only be separately accessed using the setpoint command.
setpoint is implemented as a built-in window command in magic.
The use of the window ID number is unique to this command and should be a window name like every other window-related command. Likewise, scripts would best make use of this command if the position were in layout coordinates, and magic translated them back to screen coordinates in the indicated window to set the reference point.
|Return to command index|
Last updated: March 7, 2020 at 1:06pm