[GRASS5] grass5.0/5.3 - tcltkgrass: command line in the module windows is not copyable

Glynn Clements glynn.clements at virgin.net
Tue Feb 17 22:05:41 EST 2004


Hamish wrote:

> > > A question that came up on the French speaking list: In the module
> > > windows opened by tcltkgrass, the command line that the chosen opens
> > > create is displayed in the last text field of the window. Before,
> > > one could copy this text field (and thus include the command in a
> > > script, or simply learn how to use the command line). Now, this
> > > field is not copyable anymore (at least under Debian
> > > testing/unstable with XFCE and under Mandrake 9.2). Anyone know why
> > > ?
> > 
> > I've seen the same thing with Debian/testing, versions of GRASS from
> > 5.0.2 through 5.3. (NVIZ crashes, so I figure both were compiled with
> > tcl8.4)
> > 
> > On a Redhat 7.3 system, it works ok, 5.0.3preX & GRASS 5.3 from last month.
> > I'll try compiling 5.3 with Tcl/Tk 8.3 on Debian and see if that works ...
> 
> 
> Nope, GRASS 5.3 compiled with Tcl/Tk 8.3 on Debian/testing doesn't let
> you select the command text.

src/tcltkgrass/main/gui.tcl, lines 241-242:

    [create_entry $path num $variable "" 1 ${array}(command_line)] \
        configure -state disabled -fg blue -relief solid

My suspicion is that "-state disabled" inhibits selection as well as
modification.

In 8.3.4, entry.tcl has:

	# tkEntryButton1 --
	# This procedure is invoked to handle button-1 presses in entry
	# widgets.  It moves the insertion cursor, sets the selection anchor,
	# and claims the input focus.
	#
	# Arguments:
	# w -		The entry window in which the button was pressed.
	# x -		The x-coordinate of the button press.
	
	proc tkEntryButton1 {w x} {
	    global tkPriv
	
	    set tkPriv(selectMode) char
	    set tkPriv(mouseMoved) 0
	    set tkPriv(pressX) $x
	    $w icursor [tkEntryClosestGap $w $x]
	    $w selection from insert
	    if {[string compare "disabled" [$w cget -state]]} {focus $w}
	}

The last line indicates that the widget can't get the input focus if
it's disabled. This ties in with the following in generic/tkEntry.c:

	    /*
	     * On Windows and Mac, we need to hide the selection whenever we
	     * don't have the focus.
	     */
	
	#ifdef ALWAYS_SHOW_SELECTION
	    showSelection = 1;
	#else
	    showSelection = (entryPtr->flags & GOT_FOCUS);
	#endif

Although the comment refers to "Windows and Mac", it's conceivable
that Tk may have been built without ALWAYS_SHOW_SELECTION defined, in
which case a widget without focus wouldn't show the selection
(although, AFAICT, the selection still exists, it just isn't shown).

In any case, try removing the "-state disabled" and see if that
helps.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list