Page 1 of 1

Simple Help to Cross Platform Mobile App

Posted: Thu Oct 10, 2013 10:10 am
by appmann
Hi.

Im pretty new to LiveCode and im trying to se the logic in the scripts behind it.

Im making an app with profiles. a field to "name", "Note1" & "Note2". I want to save the profiles in a Livecode DB in a substack. (Is this the easyest way to do it?)
I have buttons "New", "Edit", Cancel" & "Save".

I need help to:
- When i press new: I can write in the 3 fields fx "John", "AbbyRoad 2", "2 times".
- When i press "Save": i want to paste the text from "fields" into fields on a new card in substack.
- The new card is named by the first Field from either Main or Substack.
- If i press "cancel": Text in field disapear and no new card in substack is made.
- I want to show the profiles in some kind of list. Maby a Non-editable, scrollable, multiline field? I tryed Gridview but its hard to understand the scripting.
- If i select a profile from the list, I can press "edit" and then the field-text from the actual substack-card appears in the fields on the mainstack. Now i can Edit the text and save the new text from field, to the profile, still on the same card and still in the list, (Maby with a new "Name").

If someone want to help med doing this, and most of all, understand the script. Maby just a part of it.
Hope someone have some time to help me. THX.

Re: Simple Help to Cross Platform Mobile App

Posted: Thu Oct 10, 2013 5:46 pm
by Simon
Hi appmann,
Welcome to the forums :)

I'm not sure how many records you will have in your app but if it's less then say 50(?) go ahead with the "card" method you came up with. If there are more records then yes, a database should be used.

Here is the lesson on Data Grids which many use to display information of the type you have:
http://lessons.runrev.com/m/datagrid
Again this may be overkill for your application (and it is an intermediate/advanced topic).
Here is a Database lesson:
http://lessons.runrev.com/s/lessons/m/4 ... e-database

Note the different names of Data Grid (to display info) and Database (to store and retrieve info).

If you still wish to build your records by hand that can be done and you will find help here.

Simon

Re: Simple Help to Cross Platform Mobile App

Posted: Thu Oct 10, 2013 7:53 pm
by jacque
I've had good luck using stacks as minimal databases with stacks up to 1000 cards, or sometimes a few more, depending on the card contents and what the scripts do. LiveCode is fast.

Re: Simple Help to Cross Platform Mobile App

Posted: Thu Oct 10, 2013 8:58 pm
by Klaus
Hi appman,

yes, I even used stacks with about 5000 cards as a database when doing my first XTalk steps :)
No problem if you only have some text fields per record/card.

BUT:
You cannot save any (sub-)stack that is part of a standalone!
And you cannot save any separate stack in -> specialfolderpath("engine")
that is where all the files/folders, that you add via the "Copy files" tab
in the standalone builder, get copied to.


Best

Klaus

Re: Simple Help to Cross Platform Mobile App

Posted: Fri Oct 11, 2013 8:49 am
by appmann
Hi. Thanks for all the replys.

If i want this "substack" - DataBase to be a part of the app. And saved if the app is closed (just like "settings" in a random Mobile-App).
Why should i want to make a record of 5000 and then Not save it?

The absolute maximum of records in the database will be 50. And thats absolute MAX. Normal it will contain up to 10 records only.

Is there no way to save those? in a substack. Or does I have to implement a textfile in the app to?

Remember im Newbe and i want to do this as simple as possible.
Again thx for the replys

Re: Simple Help to Cross Platform Mobile App

Posted: Fri Oct 11, 2013 8:52 am
by appmann
By the way. Im Danish. If someone in the forum are danish i would like to talk with him or her.

Re: Simple Help to Cross Platform Mobile App

Posted: Fri Oct 11, 2013 11:26 am
by Klaus
Dag Jonas,
appmann wrote:If i want this "substack" - DataBase to be a part of the app. And saved if the app is closed (just like "settings" in a random Mobile-App).
Why should i want to make a record of 5000 and then Not save it?
No idea, maybe you would WANT to :D

Of course I saved my stuff, I just wanted to make clear that no stack (mainstack or substack)
that is part of a standalone can be saved!
appmann wrote:Is there no way to save those? in a substack. Or does I have to implement a textfile in the app to?
Yes, either store you infos in a text file or a separate stack.
Both of these need to be saved in -> specialfolderpath("documents") on the mobile platform, since that is where you app does have write permissions.


Best

Klaus

Re: Simple Help to Cross Platform Mobile App

Posted: Fri Oct 11, 2013 11:49 am
by appmann
Does someone have a sample stack or a guide to make a simple scheduler?

It is the basic of what i want to do.

Write som info to different profiles. And make the app remember it, even if its closed.

The Easyst way. The most simple scripting.

Maby i can use some of the info fdrom the livecode app academi. but just dont know where to look?

Re: Simple Help to Cross Platform Mobile App

Posted: Fri Oct 11, 2013 9:03 pm
by Simon
Hi appman,
Take a look at this lesson:
http://lessons.runrev.com/s/lessons/m/4 ... put-output

That will show you how to store information in an external file (so it will work in a standalone).
It also has fields for you to play around with entering information and saving it.
Tip: In the "read" button change the script so it opens the same file as "write"
...file specialFolderPath("desktop") & "/myData.txt" for ...

I think it's a good start for your scheduler.

Go into Users Samples (in the liveCode menu bar) and search on "Task List". It's a bit more difficult to understand but is much like your scheduler. See if you can combine the two stacks to make Task List remember your tasks without having to save the stack.

I haven't found a super simple stack that does all you want.

Simon