iPhonePick

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jnmediaGAd195
Posts: 58
Joined: Mon Dec 05, 2011 5:35 pm

iPhonePick

Post by jnmediaGAd195 » Fri May 04, 2012 10:29 pm

I am trying to put in a pick list in my (first) iOS app. I would like to use iPhonePick but I can't seem to get it work. Some very basic questions (sorry):
1. Do I put the iPhonePick statement in my button script? I tried that but it yakked at me.
2. How do I detect what has been selected?

Any help is greatly appreciated.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: iPhonePick

Post by Dixie » Fri May 04, 2012 11:02 pm

Hi...

an example that will work...

Code: Select all

on mouseUp
   put "one" & cr & "two" & cr & "three" into optionList
   iphonePick optionlist, 2
   answer the result
end mouseUp
Page 42 of the iOS release notes 'modal pick wheel support' will guide you through...:-)

be well

Dixie

jnmediaGAd195
Posts: 58
Joined: Mon Dec 05, 2011 5:35 pm

Re: iPhonePick

Post by jnmediaGAd195 » Sat May 05, 2012 12:50 am

Thanks so much. I read through the release notes. I copied and pasted your script into a button. Does it have to be a particular type of button? When I click on it, I get:
button "Option Menu": execution error at line 11 (Handler: can't find handler) near "iphonePick", char 1

I'm not normally this dense. :) Any help is appreciated.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: iPhonePick

Post by Dixie » Sat May 05, 2012 12:58 am

put the script in just an ordinary button... say, 'push button'...

be well

Dixie

jnmediaGAd195
Posts: 58
Joined: Mon Dec 05, 2011 5:35 pm

Re: iPhonePick

Post by jnmediaGAd195 » Sat May 05, 2012 1:19 am

I opened a brand new 'push button'. When I tried to compile the code, i got:
button "Button": compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "optionList", char 42

I declared optionList as a local variable. (Is that OK?) It compiled.

When I clicked on the button, I got:
utton "Button": execution error at line 5 (Handler: can't find handler) near "iphonePick", char 1

on mouseUp
   put "one" & cr & "two" & cr & "three" into optionList
   iphonePick optionlist, 2
   answer the result
end mouseUp


local optionlist

on mouseUp
   put "one" & cr & "two" & cr & "three" into optionList
   iphonePick optionlist, 2
   answer the result
end mouseUp

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4177
Joined: Sun Jan 07, 2007 9:12 pm

Re: iPhonePick

Post by bn » Sat May 05, 2012 8:56 am

Hi jn,

the mobile syntax will only work on mobile devices. In the IDE it will throw the error you describe.

try:

Code: Select all

on mouseUp
   if the environment is "mobile" then
         put "one" & cr & "two" & cr & "three" into optionList
         iphonePick optionlist, 2
         answer the result
   end if
end mouseUp
and see if that works for you. Now if you push the button in the IDE it will not throw an error and it will run on the mobile device. No need to declare the variable unless you turned "explicit variables" on.
Kind regards
Bernd

jnmediaGAd195
Posts: 58
Joined: Mon Dec 05, 2011 5:35 pm

Re: iPhonePick

Post by jnmediaGAd195 » Sat May 05, 2012 1:57 pm

This is great! Thanks so much for your help. I appreciate it.

Post Reply