empty clickLine

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

empty clickLine

Post by mattmaier » Sun Sep 21, 2014 11:54 pm

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)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: empty clickLine

Post by Simon » Mon Sep 22, 2014 1:35 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: empty clickLine

Post by mattmaier » Mon Sep 22, 2014 1:50 am

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.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: empty clickLine

Post by Simon » Mon Sep 22, 2014 2:03 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”