[GRASS5] Changing the cursor in Tcl

Michael Barton michael.barton at asu.edu
Sat Apr 15 12:00:01 EDT 2006


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

<http://aspn.activestate.com/ASPN/docs/ActiveTcl/tcl/TkCmd/cursors.htm>

__________________________________________
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 at yahoo.com>
> Date: Fri, 14 Apr 2006 23:42:02 +1200
> To: grass5 <grass5 at 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?
> 
> 
> 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
> 




More information about the grass-dev mailing list