non-editable text widget?

0 views
Skip to first unread message

Bora Ertung

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
Is it possible to make text widget non-editable?

thanks,
Bora


Gawain Lavers

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to


-state disabled

Bryan Oakley

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
Bora Ertung wrote:
>
> Is it possible to make text widget non-editable?

yes.

.text configure -state disabled

--
Bryan Oakley
oak...@bardo.clearlight.com

Bora Ertung

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
I want to insert text in it at the same time. -state disabled does not
allow me to enter text to the widget


Gawain Lavers wrote:

> Bora Ertung wrote:
> >
> > Is it possible to make text widget non-editable?
> >

> > thanks,
> > Bora
>
> -state disabled


Kano

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
Bora Ertung <bora....@sabre.com> wrote in message
news:37A1EA29...@sabre.com...

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

so enable it, insert text, then disable it.

-kl

Bora Ertung

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
that is the last thing I am thinking to do.
because I think that is gonna slow the application down.

Bora Ertung

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
Well, never mind thanks all,

Bora

James Ingham

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
Bora Ertung <bora....@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 jin...@cygnus.com
Cygnus Solutions Inc.

Bora Ertung

unread,
Jul 30, 1999, 3:00:00 AM7/30/99
to
Thank you very much James, that was what I wanted.
however, could you explain what your code is actually
doing?

Bora

Victor Wagner

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Bora Ertung <bora....@sabre.com> wrote:
: I want to insert text in it at the same time. -state disabled does not

: allow me to enter text to the widget

write proc like

proc do_insert {widget text} {
$widget configure -state normal
$widget insert insert $text
$widget configure -state disabled
}

Becouse this proc has no update calls inside, user wouldn't have chance
to get control while widget is temporarely enabled to make insertion.
If you set up widget look so that it is different in enabled state, user
wouldn't even have chance to notice that widget changed state back and
forth, becouse it wouldn't be redrawn until proc is complete.

: Gawain Lavers wrote:

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

--
--------------------------------------------------------
Victor Wagner @ home = vi...@wagner.rinet.ru
I don't answer questions by private E-Mail from this address.

Reply all
Reply to author
Forward
0 new messages