This has been driving me buggy for a few days now.
Here's the explanation:
This is an iPhone app. I have a separate PrintStack for printing a hardcopy. On this PrintStack there is an image where the user can set a logo that will show on the hardcopy. The code below work perfectly in the sim. and when printed the logo is also printed. However, when I send the app to my device, the image doesn't show on the hardcopy. It seem like setting the fileName of the image on the printStack could be the problem. I'm testing on an iPhone4 with iOS 7.1.1 but that shouldn't make a difference. I thought maybe the problem was from using pngs, but I use pngs all overt this stack.
Any help is appreciated.
This code is on a card where the user is able to choose and save the logo from their phone.
Code: Select all
on preOpenCard
if environment() is not "mobile" then exit preOpenCard
put "1" into tSettingsID ## the Logo is stored with the quote settings
put "SELECT Logo FROM MySettings WHERE SettingsID = :1" into tSQLStatement
put revDataFromQuery(tab,cr, the uDatabaseID of this stack ,tSQLStatement,"tSettingsID") into tData
put tData into tLogoName
if tLogoName is not empty then
put specialFolderPath("documents") & "/TrickPics/" & tLogoName into tLogoPath
set the filename of image "Logo" to tLogoPath
end if
end preOpenCard
on addEditSettings
local tLogo
if environment() is not "mobile" then exit addEditSettings
if the uPhotoChanged of this cd is true then
put "Logo_" & the seconds & ".png" into tLogo ## build a unique name for the pic file
put specialFolderPath("documents") & "/TrickPics/" & tLogo into tPicTest
if there is a file tPicTest then
delete file tPicTest
if there is a file tPicTest then
answer "Still Here"
end if
end if
export image "Logo" to URL("binfile:" & specialfolderpath("documents") & "/TrickPics/" & tLogo) as PNG
end if
updateLogo tLogo
end addEditSettings
command updateLogo pLogo
put "1" into SQLArray[1]
if the uPhotoChanged of this cd is true then
put pLogo into SQLArray[2]
put "UPDATE MySettings SET Logo = :2 WHERE SettingsID = :1" into tSQLStatement
revExecuteSQL the uDatabaseID of this stack, tSQLStatement, "SQLArray"
if the result is an integer then
put specialFolderPath("documents") & "/TrickPics/" & pLogo into tLogoPath
put specialFolderPath("documents") & "/PrintQuote.livecode" into tPrintQuotePath
open inv stack tPrintQuotePath
if there is an image ID 1014 of cd 1 of stack tPrintQuotePath then
set the filename of image ID 1014 of cd 1 of stack tPrintQuotePath to tLogoPath
save stack tPrintQuotePath
close stack tPrintQuotePath
answer "Logo successfully saved."
else
answer "Sorry no Image element on card."
end if
else
answer "Sorry, there was an error saving the Logo."
end if
end if
end updateLogo