Naming photo from library

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
chelling
Posts: 100
Joined: Tue Mar 06, 2007 3:14 am

Naming photo from library

Post by chelling » Sat Sep 12, 2015 7:28 pm

I am hoping someone can help me. I am trying to import an image from the iOS camera roll library. This button script works fine except for the namePhoto part. It's as if it's not running. I am testing it in the simulator. I have tried to call it from the card script, place it within the else section, and as shown after the else/end if statements. I also added a wait 0 milliseconds with messages after the end if. It's important that the user be able to name the photo. Thanks!

on mouseUp
set the icon of me to 2228
mobilePickPhoto "library", 640,480
if the result is "cancel" then
answer "No picture selected"
else
if there is an image "photoPreview" then
delete image "photoPreview"
end if
set the name of last image to "photoPreview"
wait 10 milliseconds
set the rect of image "photoPreview" to the rect of card button "imageHolder"
set the loc of image "photoPreview" to the loc of card button "imageHolder"
set the visible of image "photoPreview" to true
set the bottom of image "photoPreview" to the bottom of button "photoLocator"
end if
namePhoto
end mouseUp


on namePhoto
ask "Please name your photo"
put it into tName
put tName into field "fImageName"
end namePhoto

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Naming photo from library

Post by jmburnod » Mon Sep 14, 2015 9:43 am

Hi chelling,

Your namephoto command doesn't rename imported img.
You have to rename it and delete img if user chooses "cancel" after ask dialog

Code: Select all

on namePhoto
   ask "Please name your photo"
   if it = empty then 
      delete img "photoPreview"
      exit namePhoto
   end if
   put it into tName
   put tName into field "fImageName"
   set the name of img "photoPreview" to it
end namePhoto
Best regards

Jean-Marc
https://alternatic.ch

chelling
Posts: 100
Joined: Tue Mar 06, 2007 3:14 am

Re: Naming photo from library

Post by chelling » Wed Sep 16, 2015 12:22 am

Thank you so much for your help Jean-Marc! I just couldn't get it worked through.

Post Reply