Changing a variable in the IDE

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: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
asw
Posts: 7
Joined: Sun Mar 02, 2014 9:57 pm

Changing a variable in the IDE

Post by asw » Mon Mar 10, 2014 12:59 am

I go into the variables of my script. I have a variable myNext with a value of 800. I dbl click on the value and I get a cursor behind it. I change the value to 795 and when I press the Enter key, the value goes back to 800. How do you change the value of the variable and get it to stay? Also what is the white on green checkmark icon that appears at the end of the line when I dbl click on the value?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Changing a variable in the IDE

Post by dunbarx » Mon Mar 10, 2014 1:24 am

Hi.

If you double click in the right side of the pane and edit the variable, and then click on that checkmark, it sticks for me. Tested in commercial v5.5 and community 6.5.2.

Though I have a feeling that something is amiss. Restart LC and put something simple in a button;

Code: Select all

on mouseUp
   repeat with y = 1 to 10
      add y to ff
   end repeat
end mouseUp
Put a breakpoint in the loop and try it. Something amiss? I may have had trouble as you did until I restarted. Bears watching...

Craig Newman

asw
Posts: 7
Joined: Sun Mar 02, 2014 9:57 pm

Re: Changing a variable in the IDE

Post by asw » Mon Mar 10, 2014 12:25 pm

Hello dunbarx
I have community 6.1.1 (rc4) and tried what you said. Dbl clicked, changed the value of the variable and clicked the white/green check icon. Went right back to the old value. Thanks anyway.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Changing a variable in the IDE

Post by jacque » Mon Mar 10, 2014 6:13 pm

When you say "IDE" I assume you mean the script editor. The green checkmark appears when you are editing a variable value in the variable watcher. Clicking it does the same thing as typing the Enter key, and sets the value you've entered.

When you are debugging and stepping through the script, the Variables pane shows you the current values in the script that is currently executing. Those values will update every time you step through the code. Changing them during debugging only changes them for that single run-through, it doesn't change them permanently. To do that, you need to rescript the code that is placing values into the variables.

If you are not debugging, the the Variables pane will only show global variables. You can change those in the Variables pane of the message box. I've never tried changing globals in the script editor, but since the editor is transient it may not retain those changes.

A more specific recipe of what you're doing would help diagnose what's happening.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Changing a variable in the IDE

Post by dunbarx » Mon Mar 10, 2014 6:36 pm

Jacque.

If you change the value of a global variable in the editor as we have discussed, it retains that last value after the handler ends. You can even hard-exit the handler after the change. It sticks.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Changing a variable in the IDE

Post by jacque » Tue Mar 11, 2014 7:40 am

That's good to know, thanks. I've never thought to do it that way, I always used the message box.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Changing a variable in the IDE

Post by jacque » Tue Mar 11, 2014 7:44 am

asw wrote:Hello dunbarx
I have community 6.1.1 (rc4) and tried what you said. Dbl clicked, changed the value of the variable and clicked the white/green check icon. Went right back to the old value. Thanks anyway.
Try hitting the enter key instead of clicking the checkbox. Does it stay then?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply