New app

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
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

New app

Post by Opaquer » Sat May 03, 2014 10:33 am

Hey all

It's been a while since I've used LiveCode due to various reasons, and want to get back into it again!

I've spoken to a friend of mine who's looking for an app, and it seems viable, but I think I need a bit of a push in the right direction to get it started.

The idea is that there are a bunch of different categories that the user can choose from. Each category will have a bunch of different items to choose from (with pictures). When an item is chosen, it shows up with information about that item, which my friend can fill in. Also my friend would like to update items from their end when an item gets updated/a new item is available etc

The issue as I've mentioned above is that it's been many months since I've touched LiveCode, and I've forgotten a lot of it (though hopefully it'll come back to me :P), so I'm not sure how to start, or if it's even possible :(

Any help would be appreciated, and looking forward to getting back into LiveCode :D!

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

Re: New app

Post by Simon » Sat May 03, 2014 10:45 am

Hi Opaquer,
I think this lesson has much of what you are looking for:
http://lessons.runrev.com/s/lessons/m/4 ... r-the-ipad

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

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Sat May 03, 2014 10:54 am

This looks amazing and I think pretty much exactly what I want! Is there anything that would be different if I wanted to wanted to do it with Android instead? I don't have the tools to make an iOS app just yet :(

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

Re: New app

Post by Simon » Sat May 03, 2014 10:59 am

In a quick look I only see iphonepickphoto which has been updated to mobilePickPhoto.
You should be fine.

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

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Sat May 03, 2014 11:05 am

Excellent :D! I shall give it a try, and hopefully remember more about LiveCode in the process :D!

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Tue May 06, 2014 12:08 pm

So I've been working on the app (haven't had too much time over the last few days, so this is the first time I've actually sat down to read the lesson and work on it :P)

I've still got a few questions. From what I can tell, the lesson allows for the user to pick their picture/enter in their own entries. Is there a way (perhaps using a Dropbox document?) that will allow the app to automatically gather information? Basically, the users won't get to edit anything, just see the information my friend puts on the app (if that makes sense :P)

EDIT: So, I've managed to make it so that the app can read text from a Dropbox file of mine. Unfortunately I'm not sure how I can make it get a picture yet :(. Also, I would like to make a way to dynamically add more content based on how many items I have in the Dropbox file. So, if I've got a bunch of information in the Dropbox file, it needs to show a button for each of the items, and when the item is clicked, then it gives all the information :)

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

Re: New app

Post by Simon » Wed May 07, 2014 12:02 am

Hi Opaquer,
The trick is to change the "share" url:

Code: Select all

put url("https://dl.dropbox.com...
just that "dl" instead of "www"

It's not clear how much work your friend is willing to do for each piece of new content. For a start I'm thinking the txt and jpg would have the same name (makes it easy for you to combine them). Now you'll need a configuration file in the dropbox account that describes everything that should be in the app.

I'm going to stop there in case I'm talking crazy talk.
If you want me to continue just say.

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

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Wed May 07, 2014 1:37 pm

Simon wrote:Hi Opaquer,
The trick is to change the "share" url:

Code: Select all

put url("https://dl.dropbox.com...
just that "dl" instead of "www"

It's not clear how much work your friend is willing to do for each piece of new content. For a start I'm thinking the txt and jpg would have the same name (makes it easy for you to combine them). Now you'll need a configuration file in the dropbox account that describes everything that should be in the app.

I'm going to stop there in case I'm talking crazy talk.
If you want me to continue just say.

Simon
Hey Simon

I've got that bit working - please continue though! I've got the ability to make each field be filled out from a dropbox file. The issue I'm having though is that each line of the dropbox file should relate to a new item on the 'main page'. Then when they click that item from the 'main page', they'll be taken to a more specific page with the full details of the item. The hard part I'm having trouble with is how to make it dynamic - I could add a new button for each item, but if my friend wants to have n items, there must be an easier way to make it work rather than use a bunch of items. Also, giving each button the ability to read the correct line of the dropbox file, if that makes sense? I fear this time I might be the one talking crazy talk :P!

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

Re: New app

Post by Simon » Thu May 08, 2014 1:46 am

Hi Opaquer,
Lets talk about the configuration file:
myPlants.zip
LC 6.5
(2.21 KiB) Downloaded 265 times
That is a very simple stack for recording images and their related text (description). All the information the stack needs is written to a text file and saved.
The delimiter between image/text is tab and return is used for each item.
After adding some pics and text look in your documents folder /myPlants/Preference.txt take a look at that file.
Note that this was done using only 2 card and no "create", I think you will need a 3rd card that is an index of all the items.

The only difference between your friends "Preference.txt" file online and the local one would be the url to the image. As your friend adds new items you would compare the lines in the local Preference.txt to the online version if they are different then some action must be taken (Tip: url's are unique, there will be a bit of massaging).

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

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Fri May 09, 2014 1:42 pm

So, I've been working on it. I think It's going well (maybe)

I've hit a couple of problems though. I've currently got the app reading a dropbox file. It counts how many lines there are in the file, and creates a button and image for each line. It moves it to the right locations, names the objects accordingly and that's done. Here's the code I'm using for that bit

Code: Select all

   put the number of lines of gPref into gCount
   repeat with x=1 to gCount
      create button "Hello, "&x
      set the loc of button ("Hello, "&x) to 96,32*x-16
      create image "img"&x
      set the loc of image ("img"&x) to 16,32*x-16
      set the filename of image ("img"&y) to line y of gPref
   end repeat
gPref is the dropbox file with 4 lines, each containing a link to an image. Now, first issue: the code seems to work. The buttons and images are created and whatnot, but the issue is that for some reason the images don't update. When I run the code, the final image, img4 gets updated, and I can see the image there. But the other 3 are still empty, despite having the source filled out as the link it's supposed to be :(.

My second issue is with the buttons. I want to make each button go to a different thing, but I'm not sure how to add code to the buttons if I create them this way?

I think apart from those issues, it's pretty much done (minus final details and whatnot of course) unless something else unexpected appears!

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

Re: New app

Post by Klaus » Fri May 09, 2014 1:55 pm

Hi Opaquer,

1.
## set the filename of image ("img"&y) to line y of gPref
Should this not read:
set the filename of image ("img" & X) to line X of gPref
?

And did you check if the lines of gPref contain valid filenames?

2. Different handlers for buttons
What should the buttons do?


Best

Klaus

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Fri May 09, 2014 2:34 pm

Sorry, that y should be an x. I was testing something, but even with x, it doesn't work :(

The lines of gPref do have valid file names.

Each button should take the user to a different page, where it lets them see more information about the item

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

Re: New app

Post by Klaus » Fri May 09, 2014 2:44 pm

Hi Opaquer,
Opaquer wrote:The lines of gPref do have valid file names.
relative or absolute file pathanems? If the first, check "the defaultfolder"!
Opaquer wrote:Each button should take the user to a different page, where it lets them see more information about the item
You could additionally set the script for the new buttons:
...
set the script of btn "("Hello, " & x) to "on mouseup" & CR & "go to cd" && X & CR & "end mouseup"
## You get the picture :D


Best

Klaus

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: New app

Post by Opaquer » Fri May 09, 2014 3:18 pm

Klaus wrote:Hi Opaquer,
Opaquer wrote:The lines of gPref do have valid file names.
relative or absolute file pathanems? If the first, check "the defaultfolder"!
They're links to a dropbox file. The thing is, once the script has run, the source for the images is set as the dropbox link, and if I update it, it works!
Klaus wrote:
Opaquer wrote:Each button should take the user to a different page, where it lets them see more information about the item
You could additionally set the script for the new buttons:
...
set the script of btn "("Hello, " & x) to "on mouseup" & CR & "go to cd" && X & CR & "end mouseup"
## You get the picture :D


Best

Klaus
I didn't know that was a thing!

Post Reply