lineoffset

Jim Ault jimaultwins at yahoo.com
Fri Nov 6 19:39:40 EST 2009


>
> Maybe what I should do is simply use a repeat loop and look at each  
> item 1 of each line. If it matches the clicktext then I have the  
> line number and can load item 2 of that line into the display field.


Use this field script and it should work, plus a bit of error checking

on mouseup
    set the itemdel to "|"
    get (cr & field "storage")
    put  lineOffset( cr & the clicktext & "|", IT ) into theLineNum
    if theLineNum > 0 then
       put  item 2 to -1 of line theLineNum of IT into fld "display"

       --note item 2 to -1  means item 2 to the last item in the line
       --   the reason is in case the text of the line uses a "|" char
       --   if that is true, then you would not display the entire line
    else
       put "Not found" into fld "display"
    end if
end mouseup

Jim Ault
Las Vegas



On Nov 6, 2009, at 3:55 PM, Rick Rice wrote:

> Jim:
> 	You nailed it.
> Item 1 of field "storage" is in fact Myeloblast.
> If I click "Myeloblast" I get 1 if I click any other name the   
> lineoffset returns 0
>
> Craig:
> I tried the fullfind routine and this returned "revFullFind"
>
>
> Maybe what I should do is simply use a repeat loop and look at each  
> item 1 of each line. If it matches the clicktext then I have the  
> line number and can load item 2 of that line into the display field.
>
> Rick
>
> On Nov 6, 2009, at 3:38 PM, DunbarX at aol.com wrote:
>
>> Jim.
>>
>> I just reread your post. I think you are saying the same thing,  
>> that there
>> ain't much text in the first item of the search list.
>>
>> Craig
>>
>> In a message dated 11/6/09 6:24:48 PM, jimaultwins at yahoo.com writes:
>>
>>
>>> Like I said before, you need to answer the question:
>>>
>>> What is ( item 1 of field "storage" ) ?
>>> Use the variable watcher and breakpoint.
>>> This will show you why you would get 0 (not located)
>>> unless you clicked 'Myeloblast', and then you would get 1.




More information about the use-livecode mailing list