A couole of complete newbie questions

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
MrFollies
Posts: 29
Joined: Tue Jul 15, 2014 8:30 am

A couole of complete newbie questions

Post by MrFollies » Tue Jul 15, 2014 8:43 am

I've inherited an app written in LiveCode. Not being an app developer (I'm a unix guy) I've taken on the project with a little unease.

The first thing I've noticed is that, when doing "run" testing within the app, all of my controls are permanently changed.
So for example, I have an option box called "score" and the Label for it is "Enter Score".
Clicking on it, gives the user the option of selecting values 1 through 10.

So when I'm testing my code with the "Run" tool, I notice when I switch back to the "Edit" tool the value I selected remains.
Is there a way to make control attributes fixed when not in "Run" or debug mode?

I have other questions, but I hope to find the answer to those with google's help.

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

Re: A couole of complete newbie questions

Post by jmburnod » Tue Jul 15, 2014 9:22 am

Hi MrFollies,
Thank you for your question, which allowed me to discover the run button that I never used for OSX. 8)
I understand this button build a standalone.

A standalone can't be changed. It keep the state when it has been compiled.
You have to export the current state outside in a stack or files to get a changed state.
Best regards
Jean-Marc
https://alternatic.ch

MrFollies
Posts: 29
Joined: Tue Jul 15, 2014 8:30 am

Re: A couole of complete newbie questions

Post by MrFollies » Tue Jul 15, 2014 9:50 am

Thanks for your reply Jean-Marc.

I understand that a standalone can't be changed, but one of the advantages of LiveCode is the ability to run the code quickly and easily from the IDE.
Surely there must be a way to debug without all of the controls changing as you do so?

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

Re: A couole of complete newbie questions

Post by jmburnod » Tue Jul 15, 2014 10:09 am

Welcome,
Surely there must be a way to debug without all of the controls changing as you do so?
Yes :D
You can have an invisible standalone it call a stack. Don't forget to save the stack when you close it.
I don't use it because I prefer store files but I think it works
Best
Jean-Marc
https://alternatic.ch

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: A couole of complete newbie questions

Post by SparkOut » Tue Jul 15, 2014 3:32 pm

This old thread http://forums.livecode.com/viewtopic.php?f=7&t=7420 discusses some options which may be useful.

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

Re: A couole of complete newbie questions

Post by Simon » Tue Jul 15, 2014 4:51 pm

This old thread viewtopic.php?f=7&t=7420 discusses some options which may be useful.
Aww... People used to be so sweet.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: A couole of complete newbie questions

Post by jacque » Tue Jul 15, 2014 8:09 pm

MrFollies wrote:So when I'm testing my code with the "Run" tool, I notice when I switch back to the "Edit" tool the value I selected remains.
Is there a way to make control attributes fixed when not in "Run" or debug mode?
I think people have misinterpreted your question to involve standalones, but I think you're talking about a reset while developing.

There is nothing built-in, LiveCode truly is "live code" and whatever you do will stick until you undo it. Typically we write a little handler that resets any values to defaults, and run it on preOpenCard so that the user is always presented with a clean UI. Sometimes it isn't necessary to run it before each card opens, it's preferable to run it only once on startup, or some other time. It all depends on how the app will work.

But in any case, once that's written, you can easily run it from the message box when you want to reset all the controls to a default state. You can store the defaults in custom properties of each object, as the referenced discussion mentions, or you can hard-code values, or you can calculate them on the fly. Lots of times in the case of fields or radio buttons, the default value is empty or zero and a hard-coded handler deals with them easily. Option buttons can have their menuhistory set to your default numbered choice to reset them.

In most cases it isn't necessary to reference every control on the card. You can run a repeat loop that checks for a common property (whether the field is unlocked, has a certain name, belongs to a particular group, etc.) and empty them all at once. Push buttons virtually never need to be reset. And so forth.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply