Page 1 of 1
iPhonePick
Posted: Fri May 04, 2012 10:29 pm
by jnmediaGAd195
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.
Re: iPhonePick
Posted: Fri May 04, 2012 11:02 pm
by Dixie
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
Re: iPhonePick
Posted: Sat May 05, 2012 12:50 am
by jnmediaGAd195
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.
Re: iPhonePick
Posted: Sat May 05, 2012 12:58 am
by Dixie
put the script in just an ordinary button... say, 'push button'...
be well
Dixie
Re: iPhonePick
Posted: Sat May 05, 2012 1:19 am
by jnmediaGAd195
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
Re: iPhonePick
Posted: Sat May 05, 2012 8:56 am
by bn
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
Re: iPhonePick
Posted: Sat May 05, 2012 1:57 pm
by jnmediaGAd195
This is great! Thanks so much for your help. I appreciate it.