How do I Create a Custom Property, part 19,214,651

Chamundi Sabanathan chamundi at sonic.net
Sat Apr 24 10:39:44 EDT 2004


Newbie to Rev here...
I've been following this one with interest.  Got the idea that if Rev 
does so much for you without being told to (as mentioned this AM in 
another thread), perhaps it would supply a missing CR when you appended 
a line.  Turns out it doesn't, but in checking for that I noticed 
something else which seems weird to me.

I made a scrolling field "checkCR" and a button with the following 
script:

on mouseUp
   put "This is line 1 " & time() & CR into line 1 of field "checkCR"
   put "This is line 2 " & time() & CR into line 2 of field "checkCR"
   put "This is line 3 " & time() into line 3 of field "checkCR"
   put the number of lines of field "checkCR" & time()
   put the number of lines of field "checkCR" into tLines
   put "This is line 4 " & time() into line tLines+1 of field "checkCR"
   if char -1 of line 3 of field "checkCR" = CR then
     put "Line 3 now ends with CR " & time()
   else
     put "Line 3 still has no CR " & time()
   end if
end mouseUp

Results of first button-press were pretty much as expected:
This is line 1 7:16 AM
This is line 2 7:16 AM
This is line 3 7:16 AM
This is line 4 7:16 AM
Message box says "Line 3 still has no CR 7:15 AM"

But then things get interesting (to me, anyway):
Results of second button-press:
This is line 1 7:16 AM
This is line 2 7:16 AM
This is line 3 7:16 AM
This is line 2 7:15 AM
This is line 3 7:15 AM
This is line 4 7:15 AM
This is line 4 7:16 AM
Message box says "Line 3 still has no CR 7:16 AM"

Results of third button-press:
This is line 1 7:17 AM
This is line 2 7:17 AM
This is line 3 7:17 AM
This is line 2 7:16 AM
This is line 3 7:16 AM
This is line 2 7:15 AM
This is line 3 7:15 AM
This is line 4 7:15 AM
This is line 4 7:16 AM
This is line 4 7:17 AM
Message box says "Line 3 still has no CR 7:17 AM"

What looks weird to me is that the first put always replaces the 
contents of Line 1 of the field (as intended), but the second and third 
puts _insert_ their text rather than replacing the existing contents of 
their targeted lines.

Why would this be happening?

Chamundi


On Apr 24, 2004, at 5:14 AM, David Burgun wrote:

>> Klaus, Dave, you got me. This is a bit weird.
>>
>> A good argument for making sure you don't have trailing CRs, if all 
>> they're going to do is create this kind of weirdness!
>
> The problem is in moving the data to a field which seems to not line a 
> CR on the last line. If you replace it in the *field*, and always 
> ensure that there is a Terminating CR as the last character when 
> reading from a field, all will be well. The alternative is to have to 
> test the line list container for empty everytime to append a line to 
> it.
>
> Cheers
> Dave
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list