[GRASS5] Changing the cursor in Tcl

Hi,

I'd like to have the look "here" button in NVIZ change the cursor to a
crosshair, but my Tcl is so bad I can't get it do work. Any suggestions?

http://www.tcl.tk/man/tcl/TkCmd/cursors.htm
http://tcltk.free.fr/tcltkfaq.php3?idxquery=106

visualization/nviz/scripts/position_procs.tcl

proc look_here {W x y} {
   . configure -cursor {crosshair}
   [do stuff]
   . configure -cursor ""
}

??

thanks,
Hamish

Hamish wrote:

I'd like to have the look "here" button in NVIZ change the cursor to a
crosshair, but my Tcl is so bad I can't get it do work. Any suggestions?

You have to use the configure command on the correct widget(s). By
default, children will inherit their parent's cursor, so setting the
cursor on a top-level widget will normally affect most child widgets,
but specific widgets may override it (e.g. text widgets will change it
to an I-beam cursor).

--
Glynn Clements <glynn@gclements.plus.com>

Hamish,

Here is the procedure used in mapcanvas.tcl to temporarily change cursors
for the canvas display widget stored in array $can($mon).

Initially a global variable "mapcursor" is set with the default cursor for
the canvas

global mapcursor
set mapcursor [$can($mon) cget -cursor]

############################################################################

proc MapCanvas::setcursor { mon ctype } {
    global mapcursor
    variable can

    $can($mon) configure -cursor $ctype
    return
}

proc MapCanvas::restorecursor {mon} {
    global mapcursor
    variable can
    
    $can($mon) configure -cursor $mapcursor
    return
}

############################################################################

The variable $ctype can be set to any acceptable TclTk cursor

These are listed at

<ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.;

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Fri, 14 Apr 2006 23:42:02 +1200
To: grass5 <grass5@grass.itc.it>
Subject: [GRASS5] Changing the cursor in Tcl

Hi,

I'd like to have the look "here" button in NVIZ change the cursor to a
crosshair, but my Tcl is so bad I can't get it do work. Any suggestions?

cursors manual page - Tk Built-In Commands
Tcl Tk

visualization/nviz/scripts/position_procs.tcl

proc look_here {W x y} {
   . configure -cursor {crosshair}
   [do stuff]
   . configure -cursor ""
}

??

thanks,
Hamish