Page 1 of 1

empty clickLine

Posted: Sun Sep 21, 2014 11:54 pm
by mattmaier
At least, I assume it must be returning empty since LiveCode isn't coming up with any errors and it recognizes all of the words I used. But, clickLine should be empty in this case, right?

This is in a locked field with a few lines of text: (I grabbed the commented code thinking I could just modify it and added the variables when I got frustrated)

Code: Select all

on mouseup
   --   select the clickLine
   --   put the value of the clickLine after field "theField"
   --   hide me
   --   put empty into me
   --   focus on card field "answer
   put 4 into tVar
   --select the clickLine
   put the clickLine into tLine
   put the value of the clickLine into tLine2
   put 5 into tVar
   put tLine into tLine2
   put 6 into tVar
   put tVar into tLine
end mouseup
I click on the field and I watch everything happen like it's supposed to except that "the clickLine" doesn't return anything. Shouldn't it give me the line number?
"select the clickLine" doesn't seem to matter
but "the value of the clickLine" does return the expected string (line number of the field number)

Re: empty clickLine

Posted: Mon Sep 22, 2014 1:35 am
by Simon
Hi mattmaier,
I think what is happening is you have breakpoints and are watching the variable watcher?
Try this;
put tLine && tLine2
put that after "put the value of the clickLine into tLine2" and remove the breakpoints (red dots).
I think it is reading the value of "step" button.

Simon

Re: empty clickLine

Posted: Mon Sep 22, 2014 1:50 am
by mattmaier
OMG, is that what's happening?

You're right, when I remove the breakpoint and just add a line printing the contents of tLine & tLine2 into the end of the field all of the correct information shows up just like it should.

Is that really it? Is the clickLine trying to pull information out about the variable watcher and overwriting the information it had about the text field? That just seems like it shouldn't happen. Shouldn't the IDE be ignored?

Anyway, thanks! There's no way I would have found that on my own.

Re: empty clickLine

Posted: Mon Sep 22, 2014 2:03 am
by Simon
Hi mattmaier,
No I wouldn't take my word as gold on this, here from the Dictionary;
Comments:
The clickLine function is cleared at the next mouse click, as well as after some editing actions such as deleting text. If the last click was not in a field, the clickLine function returns empty.
Sounds like it's more to do with the mouse and not the variable watcher.

Anyways, glad it's working for you :)

Simon