Subject: Re: non-editable text widget? - DN [1]


James Ingham <jingham@leda.cygnus.com> - 30 Jul 1999 - comp.lang.tcl

 Bora Ertung <bora.ertung@sabre.com> writes:

 > I want to insert text in it at the same time. -state disabled does not
 > allow me to enter text to the widget
 >
 >

 If you are doing something fairly simple, then just remembering to
 enable the text widget, add the text and then disable it again is
 probably good enough.

 However, if you are trying to do something fancy (like use the text
 widget to make a "better" listbox widget which supports styled text),
 then you can totally disable all user input with:

 text .t
 set t_bind [bindtags .t]
 set text_pos [lsearch $t_bind Text]
 bindtags .t [lreplace $t_bind $text_pos $text_pos]

 This will remove all the user bindings to the text widget, so
 selecting will no longer work, clicking will no longer set the cursor,
 etc.  You essentially have a clean slate to start over with.  Of
 course, all the text widget commands, insert, tag, etc will still
 work.

 Kind of radical, but sometimes useful.

 Jim

 >
 >
 > Gawain Lavers wrote:
 >
 > > Bora Ertung wrote:
 > > >
 > > > Is it possible to make text widget non-editable?
 > > >
 > > > thanks,
 > > > Bora
 > >
 > > -state disabled
 >

 --
 ++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++
 Jim Ingham                                              jingham@cygnus.com
 Cygnus Solutions Inc.

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated