Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

erasing a character in a text box

Status
Not open for further replies.

erixire

Technical User
Jun 4, 2002
72
CA
Hi,

Is it possible to erase (backspace) a character in a text box, because I tried the "\b" with no effect like this:

$text insert end "before"
$text insert end "\b\b\b\b\b\b after"

Thanks for any help.
 
The \b char has no binding yet.
You need to add one:
Code:
pack [text .t]
bind .t <Control-KeyPress-b> { 
  # delete the char
  .t delete {insert - 1 char}
  # set the insert point
  .t mark set insert {insert + 1 char}
}
.t insert end &quot;a text to insert xx\n&quot;
For this to work fine be sure the text ends with a \n.

Good luck

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top