Greetings,
Let me say thanks for all who replied. I appreciate all the ideas and help!!
On Wed, 29 Dec 1999, you wrote:
> On Tue, 28 Dec 1999, [EMAIL PROTECTED] wrote:
>
> >set tmpString1 [$widget(details) get 1.0 end]
> >
> >set cr [llength $tmpString1]
>
> Is there a special reason why you use "llength"? You count
> the number of ELEMENTS in the LIST tmpString1 ...
>
Yes. I am counting words for word wrapping/formating a details section
on an invoice to pipe to the printer.
Here is the way I have decided to handle the problem. I also included my
details wrapping for inspection. It is very crude but it works nice;)
# Split out the "'s then join the string with a \"
set tmpString1 [join [split [$widget(details) get 1.0 end] \"] {\"}]
set cr [llength $tmpString1]
set tmpString2 "$date "
#counter will hold the lines that we add in the description area
set counter 1
for {set index 0} {$index<$cr} {incr index} {
if {[string length $tmpString2]>[expr $counter*70-20] && [string length
"$tmpString2 [lindex $tmpString1 $index]"]>[expr $counter*70]&& $counter==1} {
set tmpString2 "$tmpString2 [lindex $tmpString1 $index]\n\t"
set counter [expr $counter+1]
} elseif {[string length $tmpString2]>[expr $counter*65-20] && [string
length "$tmpString2 [lindex $tmpString1 $index]"]>[expr $counter*65]} {
set tmpString2 "$tmpString2 [lindex $tmpString1 $index]\n\t"
set counter [expr $counter+1]
} else {
set tmpString2 "$tmpString2 [lindex $tmpString1 $index]"
}
}
> I would recommend (to get rid of that " problem too):
>
> set tmpString1 [list [$widget(details) get 1.0 end]]
> set cr [string length $tmpString1]
>
I did a bit of testing with this and discovered some neat things but decided to
use the above code.
> This way you generate a list with ONE element; the "list"
> command takes care of all critical characters by putting
> {}s around the original string.
>
This is a nice feature.
Again, many thanks for all the help!!
> --
> Josua Dietze
> ------------
> No sigfile
> No ideas
> No money ....
>
> ---------------------------------------------------------------------------
> To unsubscribe from the Visual Tcl mailing list, please send a message
> to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
> message body (where [EMAIL PROTECTED] is your e-mail address).
--
RJ Ent. -- http://www.rjent.pair.com
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).