at_setcursor - Sets X window cursor

SYNOPSIS

source at\$tk_include:at_defs.atk

at_setcursor root cursor

ARGUMENTS

root
Any widget.
cursor
Text name of any standard X window mouse cursor.

DESCRIPTION

This procedure is part of the standard AT_DEFS. It allows the programmer to set the X window mouse pointer sprite to be any of the standard X window cursors. The root argument indicates which widgets the cursor change will affect. The change will applie to the specified window and all it's children as per the standard widget hierarchy. The cursor is the standard X window cursor name. An example program has been placed in AT$TK_INCLUDE:. This program has a series of buttons that may be activated, changing the cursor to that which is named by the label on the button. The program is called CURSORS.ATK.

The procedure returns a list cotaining a number of sublists. Each sublist has the widget name and cursor of that widget prior to the at_setcursor command. This returned argument may be passed to the at_restorecursor command, thus allowing an easy means of returning the cursors for each widget back to their original configurations.

Obviously, at_setcursor/at_restorecursor pairs may be nested (but this should be a rare event).

Example

Here is some example code that can be set the cursor. Note the update command. It ensures that the cursor change is immediately invoked in the case that the timedout operation is completely contained in the TCL script. If the program is waiting on external input, this may not be necessary. This example sets the cursor to a wrist-watch shape and then sets it back again using the at_restorecursor command.

  widgetlist [at_setcursor . watch]

# ... do any long tasks here

  at_restorecursor $widgetlist

KEYWORDS

ATwish, cursor, procedure


Original: dmckay (13-DEC-1994)
Modified: dmckay (17-JUL-1995)