Weather iOS app
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Weather iOS app
Hi everyone,
I am going deeper with LiveCode learning so I decided to make a weather app.
Is there any Weather app done in LiveCode? Anyone have experience in doing one,
any tips and tricks or some published code ...
I will use the API from http://openweathermap.org/api
When time will be and it will I will post for help under the appropriate forum section.
Thanks! everyone, this forum is the best resource.
Regards,
Catalin Anesia
PS. Is there a way or a trick to be able to work on LiveCode from the iPAD? any other tablet?
I am going deeper with LiveCode learning so I decided to make a weather app.
Is there any Weather app done in LiveCode? Anyone have experience in doing one,
any tips and tricks or some published code ...
I will use the API from http://openweathermap.org/api
When time will be and it will I will post for help under the appropriate forum section.
Thanks! everyone, this forum is the best resource.
Regards,
Catalin Anesia
PS. Is there a way or a trick to be able to work on LiveCode from the iPAD? any other tablet?
Re: Weather iOS app
The LC IDE only works on desktop machines. It would need to be completely rewritten to work on single-window mobile devices.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Hi Jacqueline,
I hoped maybe someone had a trick or something, one day hopefully the LC will be
ported on tablet, till then it still does the job as it is now.
Merci,
Catalin
I hoped maybe someone had a trick or something, one day hopefully the LC will be
ported on tablet, till then it still does the job as it is now.
Merci,
Catalin
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Tough design decision:
After 1 day (uau it is fast) of app mockup in LiveCode i have a working skeleton to
keep me going on development but I hit a dead end, so here it is:
1) I have a list of City names which correspond to a unique CODE and the API website
say it is better to use CODE not City names (will be quicker). How should I approach the
link between City and the corresponding CODE ? Where do I save or keep the City CODE's *.txt file?
should I make a big text field on a card and dump the CODE's there? what a pro in LC will do ? and for the
moment I target only iOS. (at this time I have a text field where you type City name)
2) I have envisioned the CITY list for the user to be designed as the Contact apps on today's phones
where you have the Alphabet letters on the side (vertical sorted) and when you touch one the big
address book will scroll to the first "word" starting with that letter and then you scroll down ...
Probably this is involving the very beast (tamed by some of you) of DataGrid in LiveCode ?
also probably I can avoid the DG by using Grouped fields or labels? other options ?
Thanks to set me on the right path ...
I am ok with basics of LiveCode concept but DG are a bit scarier, never dealt with them,
I read the forum daily (it is my news paper) so I know a lot of my questions are already answered somewhere.
Catalin Anesia
PS. I will post specific code questions under the appropriate beginner section ...
If this post should be moved please do so.
After 1 day (uau it is fast) of app mockup in LiveCode i have a working skeleton to
keep me going on development but I hit a dead end, so here it is:
1) I have a list of City names which correspond to a unique CODE and the API website
say it is better to use CODE not City names (will be quicker). How should I approach the
link between City and the corresponding CODE ? Where do I save or keep the City CODE's *.txt file?
should I make a big text field on a card and dump the CODE's there? what a pro in LC will do ? and for the
moment I target only iOS. (at this time I have a text field where you type City name)
2) I have envisioned the CITY list for the user to be designed as the Contact apps on today's phones
where you have the Alphabet letters on the side (vertical sorted) and when you touch one the big
address book will scroll to the first "word" starting with that letter and then you scroll down ...
Probably this is involving the very beast (tamed by some of you) of DataGrid in LiveCode ?
also probably I can avoid the DG by using Grouped fields or labels? other options ?
Thanks to set me on the right path ...
I am ok with basics of LiveCode concept but DG are a bit scarier, never dealt with them,
I read the forum daily (it is my news paper) so I know a lot of my questions are already answered somewhere.
Catalin Anesia
PS. I will post specific code questions under the appropriate beginner section ...
If this post should be moved please do so.
Re: Weather iOS app
The easiest API for weather I have come across is from forecast.io
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Thanks! Dixie,
I looked into it but the down side I see is that I can not call the API with City name,
or maybe I did not found the way ... (latitude,longitude is required) how do I get that for
the City that User wants to select? I have no idea how to use Location service
Did you worked on Weather apps? any tips? ...
Regards,
Catalin
I looked into it but the down side I see is that I can not call the API with City name,
or maybe I did not found the way ... (latitude,longitude is required) how do I get that for
the City that User wants to select? I have no idea how to use Location service

Did you worked on Weather apps? any tips? ...
Regards,
Catalin
Re: Weather iOS app
Hi Catalin,
1. you can use a custom property to store your (text) file.
But in your case you better use a field and also use that field to let the user choose a city.
Make a TAB delimited text file if possible:
Name of City TAB code for that city
Name of City2 TAB code for that city2
...
And import this into a list field!
Set the TABSTOPS of that field so the user will not see the CODES.
2.
a. Then create your alphabet buttons, and label them A, B, C etc...
b. Group all these buttons
c. Add this script to the group:
d. Then you can easily extract the corresponding CODE to a selected city:
...
set itemdel to TAB
put item 2 of the selectedtext of fld "citylist" into tCode
...
Best
Klaus
1. you can use a custom property to store your (text) file.
But in your case you better use a field and also use that field to let the user choose a city.
Make a TAB delimited text file if possible:
Name of City TAB code for that city
Name of City2 TAB code for that city2
...
And import this into a list field!
Set the TABSTOPS of that field so the user will not see the CODES.
2.
a. Then create your alphabet buttons, and label them A, B, C etc...
b. Group all these buttons
c. Add this script to the group:
Code: Select all
on mouseup
## What button did the user click:
put the label of the target into tFirstChar
## Check if a City with that first character is in the list
put lineOffset(CR & tFirstChar, field "citylist") into tOffSet
## Without the trick with "CR & tFirstChar" lineoffset will not look for the first character of the lines!
if tOffSet = 0 then
beep
exit mouseup
end if
## Success! Now scroll the first line starting with that character into view:
set the scroll of field "citylist" to round(tOffSet * the effective textHeight of field "citylist")
end mouseup
...
set itemdel to TAB
put item 2 of the selectedtext of fld "citylist" into tCode
...
Best
Klaus
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Dear Klaus,
You just made me a happier LiveCode user ...
Thanks!
You just made me a happier LiveCode user ...
Thanks!
Re: Weather iOS app
There is some background information on different data formats, apps, mashups and even a weather example at https://sites.google.com/a/pgcps.org/li ... rogramming (sections 3.1 and 3.2)
It is short reading
You can get the latitude,longitude of your city using a Geocoding API such as Google Map's. (Do a Google search on "geocoding api"
It is short reading
You can get the latitude,longitude of your city using a Geocoding API such as Google Map's. (Do a Google search on "geocoding api"
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Thanks! Newbie4,
I started all this (LiveCode) due to your well know web page ...
I read your mashup link a few times already and did your weather example so
I am building on top of that knowledge + some crazy design ideas
and dev.
Regards!
I started all this (LiveCode) due to your well know web page ...
I read your mashup link a few times already and did your weather example so
I am building on top of that knowledge + some crazy design ideas

Regards!
Re: Weather iOS app
Thanks, you are doing a great job. You are getting to be an expert in your own right by the quality of your questions.
Please post some screen shots of your app when it is done. Thanks
Please post some screen shots of your app when it is done. Thanks
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
Re: Weather iOS app
Hi Catalina,
To add some icing on the cake you could add this as that last line in the groups "mouseup" handler:
Looks quite "pro" and will prevent eventual suprise when the user now uses the arrow keys to navigate throught the list field!
Know what I mean?
Best
Klaus
You're welcome!catalinanesia wrote:Dear Klaus,
You just made me a happier LiveCode user ...
Thanks!

To add some icing on the cake you could add this as that last line in the groups "mouseup" handler:
Code: Select all
...
set the hilitedlines of fld "citylist" to tOffSet
end mouseup
Know what I mean?

Best
Klaus
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Dear Klaus,
I have been testing/playing/shuffling your code but unfortunately I have not been able to make it work ...
It will always go on top at the first line ... your instructions were pretty straight forward so I think is
a little problem in to the CODE.
I have a "Scrolling List Field" named citylist (Contains city names and codes TAB delimited), a group of buttons (ABCDEF) and your code in the group script ...
If you have a chance will you review the code and give me a hint ?
Thanks!
Catalin
I have been testing/playing/shuffling your code but unfortunately I have not been able to make it work ...
It will always go on top at the first line ... your instructions were pretty straight forward so I think is
a little problem in to the CODE.
I have a "Scrolling List Field" named citylist (Contains city names and codes TAB delimited), a group of buttons (ABCDEF) and your code in the group script ...
If you have a chance will you review the code and give me a hint ?
Thanks!
Catalin
-
- Posts: 83
- Joined: Sun Feb 16, 2014 10:08 pm
Re: Weather iOS app
Wowww Klaus,
Sorry for me rushing into conclusions ...
It works perfect if I give a name on the buttons "Label" under properties ...
I'm embarrassed, please accept my apologies regarding your perfect CODE.
Enjoy!
Catalin
Sorry for me rushing into conclusions ...
It works perfect if I give a name on the buttons "Label" under properties ...
I'm embarrassed, please accept my apologies regarding your perfect CODE.
Enjoy!
Catalin
Re: Weather iOS app
Hi Catalin,
just tested my script and it worked as exspected!?
I slightly modiefied the "hilite" part to take the additional CR into account:
Best
Klaus
just tested my script and it worked as exspected!?
I slightly modiefied the "hilite" part to take the additional CR into account:
Code: Select all
on mouseup
## What button did the user click:
put the label of the target into tFirstChar
## Check if a City with that first character is in the list
put lineOffset(CR & tFirstChar, field "citylist") into tOffSet
## Without the trick with "CR & tFirstChar" lineoffset will not look for the first character of the lines!
if tOffSet = 0 then
beep
exit mouseup
end if
## Success! Now scroll the first line starting with that character into view:
set the scroll of field "citylist" to round(tOffSet * the effective textHeight of field "citylist")
if tOffset > 1 then
add 1 to tOffset
end if
set the hilitedlines of fld "citylist" to tOffSet
end mouseup
Klaus