Text widget -show option or equivalent?? 
Author Message
 Text widget -show option or equivalent??

In the entry widget there is an option "-show" which enables one to
control characters being displayed in the entry widget, so the user
sees, for example, a "*" rather than the real input character. Is such
possible with the text widget?? I am aware of the -elide option but
that doesn't suit my purposes: I want the user to see text going in
but not the actual character itself. Any ideas greatly appreciated.
thanks...Larry
*********************
to send direct email remove "fake" from address


Sat, 24 Jul 2004 11:12:49 GMT  
 Text widget -show option or equivalent??

Quote:

> In the entry widget there is an option "-show" which enables one to
> control characters being displayed in the entry widget, so the user
> sees, for example, a "*" rather than the real input character. Is such
> possible with the text widget?? I am aware of the -elide option but
> that doesn't suit my purposes: I want the user to see text going in
> but not the actual character itself. Any ideas greatly appreciated.

Something like this isn't really supported by the text widget.
You could simulate it somehow, or create a font that has all
the chars looking the same.

--
  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/
      Tcl Support and Productivity Solutions



Sat, 24 Jul 2004 13:47:35 GMT  
 Text widget -show option or equivalent??
My guidelines:

1. Write a new widget based on the text widget. Use [incr tcl], Tix
etc.
2. Add a variable to your text widget.
In order to do that, bind all possible events that change text on the
widget to some UpdateVariable command.
3. Add a -show flag/option
4. In UpdateVariable, compare the value of the -show with the delta of
the text.

I'd like to see a -variable option added to the original text
variable.

Quote:

> In the entry widget there is an option "-show" which enables one to
> control characters being displayed in the entry widget, so the user
> sees, for example, a "*" rather than the real input character. Is such
> possible with the text widget?? I am aware of the -elide option but
> that doesn't suit my purposes: I want the user to see text going in
> but not the actual character itself. Any ideas greatly appreciated.
> thanks...Larry
> *********************
> to send direct email remove "fake" from address



Sat, 24 Jul 2004 17:04:16 GMT  
 Text widget -show option or equivalent??

Quote:
> I'd like to see a -variable option added to the original text variable.

And what would it contain? Just the text for the widget or the markup
also?

L

--

Why do you need a driver's license to buy liquor when you can't drink
and drive?



Sat, 24 Jul 2004 23:28:48 GMT  
 Text widget -show option or equivalent??

Quote:

> In the entry widget there is an option "-show" which enables one to
> control characters being displayed in the entry widget, so the user
> sees, for example, a "*" rather than the real input character. Is such
> possible with the text widget?? I am aware of the -elide option but
> that doesn't suit my purposes: I want the user to see text going in
> but not the actual character itself. Any ideas greatly appreciated.
> thanks...Larry
> *********************
> to send direct email remove "fake" from address

This is a typical widget callback problem, which you can solve with the
aid of the widget callback package Wcb, written in pure Tcl code.
Download this extension from my Web page given below, and then proceed
like in the following example:

     package require Wcb

     #
     # Visible text widget with before-insert
     # and before-delete callbacks
     #
     pack [text .t]
     wcb::callback .t before insert insertCb
     wcb::callback .t before delete deleteCb

     #
     # Invisible text widget
     #
     text .shadow

     #
     # Before-insert callback insertCb
     #
     proc insertCb {w idx args} {
         #
         # Replace each non-newline character to
         # be inserted into the widget with a *
         #
         set n 1
         foreach {str tagList} $args {
             regsub -all "\[^\n]" $str * newStr
             wcb::replace $n $n $newStr

             incr n 2
         }

         #
         # Insert the original strings (with the given
         # tags) into the invisible text widget
         #
         set index [$w index $idx]
         eval .shadow insert $index $args
     }

     #
     # Before-delete callback deleteCb
     #
     proc deleteCb {w args} {
         #
         # Delete the text area specified by the list $args of
         # one or two indices from the invisible text widget
         #
         foreach idx $args {
             lappend indices [$w index $idx]
         }
         eval .shadow delete $indices
     }

The visible text widget .t will contain only * and \n characters, while
the secret text will be inserted into the invisible text widget
.shadow.

Notice that this method can be modified in several ways.  For example,
it can be adapted to entry widgets and used instead of the -show
configuration option if the characters to be inserted are to be
replaced with an *arbitrary* number of other characters.

--



Sun, 25 Jul 2004 05:02:19 GMT  
 Text widget -show option or equivalent??
On Tue, 05 Feb 2002 22:02:19 +0100, Csaba Nemethi

Quote:

>This is a typical widget callback problem, which you can solve with the
>aid of the widget callback package Wcb, written in pure Tcl code.
>Download this extension from my Web page given below, and then proceed
>like in the following example:

thanks very much.. looks good, I will try it!

Larry
*********************
to send direct email remove "fake" from address



Sun, 25 Jul 2004 09:46:23 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How to resize a text widget to show all text

2. Windows: entry with -show option copies visible text

3. Some questions on elided text in the text widget (and a few other text widget questions)

4. Stopping special chars from showing in a text widget

5. Q: how to show cursor in the Text widget in Read-Only mode

6. getting text widget to show newlines and tabs as \n and \t

7. Setting Unicode/BIG5 options for text widgets under Windows TCL/TK

8. Setting Unicode/BIG5 options for text widgets under Windows TCL/TK.

9. Add -tabwidth option to Text widget

10. text widget tag options

11. mixed font in widget -text option

12. what to use in -bgstipple option in text widget tags

 

 
Powered by phpBB® Forum Software