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

Klaus Major klaus at major-k.de
Wed Apr 21 14:15:27 EDT 2004


Hi David,

>>> Here is sample code to demonstrate:
>>>
>>> on mouseUp
>>>   put empty into myLineList
>>>
>>>   put myLineList & "Line1" & return into myLineList
>>>   put the number of lines in myLineList into myLineCount
>>>
>>>   put myLineList & "Line2" & return into myLineList
>>>   put the number of lines in myLineList into myLineCount
>>>
>>>   put myLineList & "Line1" & return into myLineList
>>>   put the number of lines in myLineList into myLineCount
>>>
>>>   if line 1 of myLineList = line 3 of myLineList then
>>>     beep
>>>   end if
>>> end mouseUp
>>
>> Will beep and have 3 (?) in myLineCount...
>
> Yes!
>
>> This is very strange!!!
>
> To you maybe, but to me it's as it should be!
>
>> I put myLineList into a field and set its listbehaviour to true...
>>
>> Guess what!
>> You can select an empty line 4!!!
>
> If this isn't the desired action, then just strip off the terminating 
> CR of the last line in the FIELD.

Go figure :-D

> Seems way better to just do the test once when moving into a field 
> rather than every time you need to append a line to the list.
>
> However, this seems buggy to me. If the line count is returned as 3, 
> then 3 lines should be transfered, no?

But how comes the empty line 4 into play???

The linecount is 3 but there are (proven) 4 lines in the field???

Why not simply create a tiny function:

function appendix what, where
   if char -1 of where <> CR then
    put CR after where
   end if
   return where & what
end appendix

## what -> to append
## where -> to append :-)

> Happy Coding
> Dave

Regards

Klaus Major
klaus at major-k.de
www.major-k.de


P.S.
I live in germany...
Where do you live?

I will get this info!
Even if this will be the last action in my life... ;-)



More information about the use-livecode mailing list