[GRASS-dev] new interactive rules setting for TclTk

Michael Barton michael.barton at asu.edu
Mon Jun 25 23:23:02 EDT 2007



On 6/25/07 8:02 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:

> 
> Michael Barton wrote:
> 
>> I've just committed a new script (rules.tcl) for the TclTk GUI that permits
>> interactive rule setting without needing an xterm for r.colors, r.reclass,
>> r.recode, and v.reclass. The interface lets you select the input map and  an
>> output map (except for r.colors where it is not needed), and offers a simple
>> text widget where rules can be entered. There are several improvements I'd
>> like to add and hope that someone can help with.
>> 
>> 1. I've managed to bind Control-c for copying in the text widget (Control-x
>> already cuts), but can't get Control-v to paste.
> 
> Try changing:
> 
>     $rules_text tag bind <Control-v> {%W insert [selection get]}
> to:
>     $rules_text tag bind <Control-v> {tk_textPaste %W}

Thanks for the idea, but I already tried this. At least on my Mac it won't
paste into the text widget (though it WILL paste elsewhere, indicating that
copy works)

> 
> AFAICT, tk_textPaste pastes the clipboard, while "selection get" returns
> the primary selection (use "selection get -selection CLIPBOARD" if you
> want the contents of the clipboard).
> 
> Actually, it should probably just use the "bind" command rather than the
> text widget's "tag bind" command (the latter is intended for applying
> bindings to specific regions of text, e.g. for implementing hyperlinks).
> 
> Also, those bindings should probably be applied to all text widgets, not
> just that one, e.g.:
> 
>     bind Text <Control-c> {tk_textCopy %W}
>     bind Text <Control-v> {tk_textPaste %W}

I think I tried both of these too, but now I can't remember--so I'll try
them and see.

> 
> FWIW, my version of Tk (8.4.9) already has Ctrl-C and Ctrl-V bound to
> Copy/Paste.

This is real weird. I'd say it's a Mac problem, but I'm using x11 TclTk (I
think 8.4.12).

Michael


__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
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





More information about the grass-dev mailing list