Replacement vs. insertion of lines in a field

Chamundi Sabanathan chamundi at sonic.net
Mon Apr 26 01:28:15 EDT 2004


(Giving this a new subject line as it has nothing to do with custom 
properties)

OK, this is embarrassing.  In my earlier post (below), the time on each 
line of results from the first button-press should have read  7:15 AM, 
not 7:16 AM:

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

No wonder nobody bothered to respond, since the data I provided was bad.

Restating my question:  Why is it that when I press the button a second 
or third time (see below), line 1 is overwritten as expected but all 
other lines are "moved down" in the field (the new material being 
treated as an insertion rather than a replacement)?

I'm using Rev 2.2 on Mac OS X (10.3.3).

Chamundi



Begin forwarded message:

> From: Chamundi Sabanathan <chamundi at sonic.net>
> Date: April 24, 2004 7:39:44 AM PDT
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Subject: Re: How do I Create a Custom Property, part 19,214,651
>
> 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
>
please see above correction to this next paragraph.
> 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