iphonePick Question

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

iphonePick Question

Post by Nakia » Tue Jun 12, 2012 8:11 am

Hi,

I have the below code which is taking the contents of a file, placing it in a variable then using that to populate a button.
when the selection is pressed that is then placed into the label of the button.

Problem is, when ever any line that ends in 0 is pressed IE 10,20,30 it is exiting the handler because of the 0 behind the leading number.
I have tried adding in the wholematches command but the error still occurs.

any ideas?

Code: Select all

 if the environment is not mobile then exit mouseDown
      put specialfolderpath(documents) & "/pilots.dat" into thePath
      put url ("file:"& thePath) into tList
      iphonePick (tList)
         put the result into tResult
      set the wholematches to true
      if tResult contains "0" then exit mouseDown
   if tResult is not empty then 
      put "ID=" & word 3 of line tResult of tList into line 1 of fld "ScoreRunS1"
      set the label of btn "PilotID" to line tResult of tList
      set the filename of image "PilotImage" to specialfolderpath("documents") & "/" &  word 3 of line tResult of tList  & ".png"
      end if

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

Re: iphonePick Question

Post by Klaus » Tue Jun 12, 2012 9:26 am

Hi Nakia,
if tResult contains "0" then exit mouseDown
well, what did you exspect with this line? :shock:

Maybe this is better:
...
if tResult = empty then exit mouseDown
...

Best

Klaus

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

Re: iphonePick Question

Post by bn » Tue Jun 12, 2012 9:45 am

Hi Nakia,

try

Code: Select all

if tResult = 0 then exit mouseDown
to catch "cancel" of the popUp

"contains" means among other things.

kind regards
Bernd

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: iphonePick Question

Post by Nakia » Tue Jun 12, 2012 9:57 am

Klaus wrote:Hi Nakia,
if tResult contains "0" then exit mouseDown
well, what did you exspect with this line? :shock:

Maybe this is better:
...
if tResult = empty then exit mouseDown
...

Best

Klaus
If I had the answer I wouldn't have posted the question :evil:
I am not an expert like you Klaus..

Thanks Bernd for your help..

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

Re: iphonePick Question

Post by Klaus » Tue Jun 12, 2012 10:21 am

There is an entry about "contains" in the dictionary, but OK, I got the message!

Post Reply