Run vs Edit modes.

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
luishp
Posts: 5
Joined: Thu Feb 10, 2011 11:24 am

Run vs Edit modes.

Post by luishp » Sat Feb 12, 2011 10:02 am

I'm very new developing in LiveCode (just a few days)
Althougt i'm very happy about the learning curve i can't figure out the answer for a very simple question.
In any other IDE when i stop running for testing an application, everything returns to it's original place/values.
In LiveCode any change made at run-time persists at design-time and don't know how to return to the original state.
For instance if i have a button with this script:

Code: Select all

on mouseup
  set the backgroundcolor of me to "Red"
end mouseup
and i try it in run mode clicking the button, the background will become red even when i return to design mode.
Any help would be very appreciated.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Run vs Edit modes.

Post by BvG » Sat Feb 12, 2011 11:09 am

There is no going back. So you need to undo changes by yourself, if you need that. for example:

Code: Select all

on mouseup
  if the backgroundcolor of me is "red" then
    set the backgroundcolor of me to "" --let higher level color setting show trough
  else
    set the backgroundcolor of me to "Red"
  end if
end mouseup
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Run vs Edit modes.

Post by jmburnod » Sat Feb 12, 2011 11:27 am

Hi Luis,

Welcome.
don't know how to return to the original state
Very useful for buttons :
you can also have some icons for each state
The icon = the short id of an image you have in your stack
Look at "icons & border" of the object inspector.

For others you can return to the original state at preopencard

Code: Select all

on preopencard
   put "myGrc" into tGrc
   -- directly in script
   set the backgroundcolor of grc tGrc to blue
   -- by the custompropertie of the object
   set the backgroundcolor of grc tGrc to the myColor of grc tGrc
end preopencard
Someone will you explane better (my english is under construction).

I hope this help

All the best

Jean-Marc
Last edited by jmburnod on Sat Feb 12, 2011 1:45 pm, edited 1 time in total.
https://alternatic.ch

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Run vs Edit modes.

Post by Klaus » Sat Feb 12, 2011 1:40 pm

Hi Luis,

yet, Livecode is different and one has to get used to this!
On the other hand, the name of the beast is LIVECode 8)


Best

Klaus

jharris
Posts: 84
Joined: Wed Jan 26, 2011 3:28 am

Re: Run vs Edit modes.

Post by jharris » Sat Feb 12, 2011 2:54 pm

I am also new to LiveCode... I had the same question. I have been clearing everything in preopencard as stated above, that seems to work well. After working with .Net and RealBasic for so long LiveCode is hard to get used to.
After a couple of weeks though I must say that I am really enjoying using it. (I just wanted to post. I don't know enough at this time to really help anyone.)
Operating System: macOS Monterey Version 12.5
LiveCode Version: 9.6.8

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: Run vs Edit modes.

Post by doc » Sat Feb 12, 2011 3:04 pm

Hello Luis,
I usually add a button or other control such as a label positioned out of the way somewhere and add the handlers needed to reset the various things. That gives me the ability to easily reset at any time during development and I've also found that it gives me a head start on organizing the code that I will want to use during a "preopenstack" initialization process anyway.

While I'm at it, in addition to the above, I usually add a handler and whatever else is necessary to reset and populate my test data, rather than reopening files numerous times, or playing the cut/copy/paste game, over and over.

Makes for a smooth process overall.

Best regards,
-Doc-

luishp
Posts: 5
Joined: Thu Feb 10, 2011 11:24 am

Re: Run vs Edit modes.

Post by luishp » Sat Feb 12, 2011 6:54 pm

Thank you very much for all your quick answers.
I'm trying to get used to this different way of programming.
It's very interesting and seems very powerfull too, but for now i still missing a "reset" button in the IDE main menu.
Anyway i've had a very nice feeling with you, the LiveCode community.
I hope to learn and contribute as much as possible.
Regards from Spain.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Run vs Edit modes.

Post by mwieder » Sat Feb 12, 2011 8:59 pm

Luis- In the File menu of the IDE there's a menuItem for "Revert to Saved..." which will reload the stack from disk. This will, of course, lose any changes since the last time you saved to disk, but it may act as a "Reset" button for you if you really need it. Mostly, though, I think that as you get used to working in LiveCode you won't miss that functionality at all.

(although I do sometimes wish I could undo some stupid things I've done in stacks)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Run vs Edit modes.

Post by mwieder » Sat Feb 12, 2011 9:03 pm

Doc- I do something similar, but usually try to refactor the code so that it's called by both the button and the setup script:

Code: Select all

--in mouse button
on mouseUp
  setupStuff
end mouseUp

--in card script
on preOpenStack
  setupStuff
end preOpenStack

on setupStuff
  -- do the heavy lifting here
  -- reset things to an initial state
end setupStuff

Post Reply