http://qs1969.pair.com?node_id=264445


in reply to Possible bug in Tk::Text

The Tk::Text POD documents this behavior:
Name: state Class: State Switch: -state Specifies one of two states for the text: normal or disabl +ed. If the text is disabled then characters may not be inserted or + deleted and no insertion cursor will be displayed, even if the inpu +t focus is in the widget.

While this may seem inconsistent when compared with the behavior of other widget classes, I've always assumed there was a good reason for it. If you want a Text widget that can't be modified, but that doesn't require toggling -state, you can always use Tk::ROText, which replaces the bindings that are normally used to modify the text with noops.

Replies are listed 'Best First'.
Re: Re: Possible bug in Tk::Text
by zakb (Pilgrim) on Jun 10, 2003 at 07:47 UTC

    I'd missed that in the POD. However, the POD for Tk::Entry says exactly the same, word for word, but Entry allows the text to be changed programmatically no matter what the state. The key difference is between what the user is allowed to do (which is what state controls) and what the programmer is allowed to do.

    Tk::ROText won't work for me, I need the text to be read/write for the user, just not all the time.