Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

what is in an empty textbox?


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

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?

> Mark

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

Regards,

Arjen

On 16 Mai, 12:51, Arjen Markus <arjen.mar@wldelft.nl> wrote:

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

On 16 May 2007 03:32:32 -0700, 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 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.brom@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.

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

-->
0
0a

uwe

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

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc