Application session

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
Voyd
Posts: 13
Joined: Thu Mar 10, 2016 8:11 pm

Application session

Post by Voyd » Thu Mar 31, 2016 3:43 pm

Hi all,

I'm not sure if can explain this problem with understanding and maybe that's why I could not find a solution.

I'm creating standalone apps for all platforms but when i load the app and entered a few inputs on windows (have not tested it on other platform), then I leave the card, then go back to it, the fields remember what I've entered. Also I have a few groups for certain ages visible set to false, depending on the age selected, it should show the respective group, but during the same session I go back and change the age then go back to the card, both the previous ageGroup selected and the new ageGroup visible is set to true, overlapping each other

So my question is, how do I set a card to forget any previous change when leaving the card?

I could clear all fields and variables on the card up on leaving but what about the visibility? Would i need to set the visible to false upon leaving?
Or is there a way to set the entire card back to its original state of when the app was launched.

Hope my grammar is not too bad to understand.


Thank you


Sheldon

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Application session

Post by quailcreek » Thu Mar 31, 2016 4:07 pm

Hi,
You can do this by resetting things in an openCard, preOpenCard or closeCard handler (look these up in the dictionary) placed in the card script of the card that contains the object you are working with. As an example you can (put empty into field "fred" or set the visible of button "wilma" to false). LC only does what you tell it.
Tom
MacBook Pro OS Mojave 10.14

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

Re: Application session

Post by dunbarx » Thu Mar 31, 2016 4:10 pm

Hi.

The right way to do this is to store all the relevant properties and reset them upon "closeCard". I do not know how many controls you need to do this with, but at least it only has to be set up once. You would likely have to do this in a long list of single line settings, though perhaps a loop might do some of the work for you. (pseudo):

Code: Select all

on closeCard
set the loc of fld 1 to someLoc
set the text of fld 1 to empty
set the loc of fld 2 to someOtherLoc
...
end closeCard
Note you can store this entire handler in a field or a custom property, and then just "do" that field or put the property in a variable and "do" that.

Craig Newman

Voyd
Posts: 13
Joined: Thu Mar 10, 2016 8:11 pm

Re: Application session

Post by Voyd » Thu Mar 31, 2016 4:46 pm

Thank you, Tom and Craig

I had that option in mind but thought there was a master reset that reset the entire application to when it was launched.

Thank you for your help, I will implement that now.



Sheldon

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

Re: Application session

Post by dunbarx » Thu Mar 31, 2016 4:51 pm

...thought there was a master reset that reset...
Here is the wrong way to do it. Make your standalone the actual working stack. Then nothing will be saved at all.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10089
Joined: Fri Feb 19, 2010 10:17 am

Re: Application session

Post by richmond62 » Thu Mar 31, 2016 7:17 pm

The right way to do this
Really? I didn't know there was a rigid orthodoxy in these things.

Personally I'd like to rephrase that to" "One of the ways to do this"

Post Reply