Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what is in an empty textbox?

6 views
Skip to first unread message

Mark Tarver

unread,
May 16, 2007, 6:32:32 AM5/16/07
to
I recently created an empty textbox and wanted to find what TCL
thought was in it.
I used these commands

% text .t
% pack .t
% .t get 1.0 end
% set x [.t get 1.0 end]


% puts [string length $x]
1

What is in x exactly?

Mark

Arjen Markus

unread,
May 16, 2007, 6:51:17 AM5/16/07
to

The end-of-line character that marks the end-of-text.

Regards,

Arjen

suchenwi

unread,
May 16, 2007, 6:54:47 AM5/16/07
to
On 16 Mai, 12:51, Arjen Markus <arjen.mar...@wldelft.nl> wrote:
> On 16 mei, 12:32, Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:
>
> > I recently created an empty textbox and wanted to find what TCL
> > thought was in it.
> > I used these commands
>
> > % text .t
> > % pack .t
> > % .t get 1.0 end
> > % set x [.t get 1.0 end]
>
> > % puts [string length $x]
> > 1
>
> > What is in x exactly?
>
> The end-of-line character that marks the end-of-text.

You can check for yourself:
% pack [text .t]
(6247) 2 % set it [.t get 1.0 end]


(6247) 4 % format %02x [scan $it %c]
0a
(6247) 5 %
and \x0A is ASCII LF = \n

Jonathan Bromley

unread,
May 16, 2007, 6:54:05 AM5/16/07
to
On 16 May 2007 03:32:32 -0700, Mark Tarver <dr.mt...@ukonline.co.uk>
wrote:

The trailing newline that ALWAYS exists at the end of the
contents of any textbox, try as you might to get rid of it.

I'm sure there is a perfectly good reason for this, but
I have to confess that I find it to be an accursed nuisance.

It's easy to deal with it when you know it's there...

set x [.t get 1.0 end-1c]
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan...@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.

Message has been deleted

Uwe Klein

unread,
May 16, 2007, 7:17:06 AM5/16/07
to
text .t
pack .t
.t get 1.0 end

set x [.t get 1.0 end]


puts [string length $x]

binary scan $x H* hex
puts $hex

-->
1
0a

uwe

Message has been deleted
0 new messages