offset problem

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, asayd

Post Reply
Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 79
Joined: Sat Apr 17, 2010 9:21 am

offset problem

Post by Rob van der Sloot » Wed Jul 30, 2014 3:23 pm

I want to retrieve some lines from a field

so I made a button saying:

on mouseUp
lineOffset ("zen", field "CompanyFindTotal")
end mouseUp

where "zen" is a string in one of the lines of the field "CompanyFindTotal"

This is totally in accord with the dictionary, from where I copied this

yet I get the message:

execution error at line 2 (Handler: can't find handler) near "lineOffset", char 1

I don't understand this

please help me out.

Thanks

Rob van der Sloot

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: offset problem

Post by FourthWorld » Wed Jul 30, 2014 3:51 pm

Lineoffset is a function; it returns a value but is not a command. So you'll need a command there to tell LC what you want to do with that value.

For example, if you want to put the value into another field:
put lineoffset("zen", field "CompanyFindTotal") into fld "FoundStuff"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 79
Joined: Sat Apr 17, 2010 9:21 am

Re: offset problem

Post by Rob van der Sloot » Wed Jul 30, 2014 8:34 pm

Thanks, I already found my problem in this setup. I used the lineoffset in a field with tabs, like records, and therfore did not work.
I also found that in the lineOffset function, the lineToFind must be an expression, and I want to use a variable there, which is therefore also not working.
So how do I find the linenumber in a field by using a variable. I changed my script into:

put lineOffset (tFind, field "Find") into field "SelectedLine".

But the result is 0.
I searched in the lessons page, but no answer there.
What I actualy want to do is put some text in a field. Then by closing the field I want do a find in another field.
The line where the searchstring is in I want to get the line number, so that I can present that whole line in a datagrid. The script for that was like this:

on closeField
local tFind
put quote & me & quote into tFind
put lineOffset (tFind, field "Find") into field "SelectedLine"
end closeField

But it does not work, so how to work this out.


Thanks

Rob

Post Reply