I have an app that contains two cards. I am running into an issue that I can't seem to figure out. Here is some background: The first card has a multiline text control that accepts user input text. I have a global variable MyVarText that stores the text. When a user taps a button, they are taken to the second card to perform edits on the original text. The text from the variable loads fine on my iOS simulator but on actual device with 6.1.3 the variable does not load into the text box of the second card.
a) I have used MOBGUI for most controls and notice it places "development" for the environment in the controls script. (Which I have not changed to "mobile" in other apps and they have worked fine) Could this play a role?
b) You will notice by the code below that I have closed the initial card in the button script prior to opening second card. This was due to the created multiline control showing up on the second card over top of the other controls. I tried hiding it without success and closing the previous card worked so have stuck with that. May this also play a role?
If anyone has an idea as to why the MyVarText global variable is not loading on the second card on the actual device, but works on the simulator, I would sure be appreciative!
This is the first card script
Code: Select all
on preOpenCard
# mobGUIStart ---> Inserted by mobGUI plugin
if "MobGUILib-1365522214984.464844" is not among the lines of the stacksInUse then start using stack "MobGUILib-1365522214984.464844"
mobGUIPreOpenCard me
# mobGUIEnd
end preOpenCard
local inputID
global MyVarText
on clearFields
iphoneControlSet inputID, "text", empty
put empty into MyVarText
end clearFields
on openCard
if environment() <> "development" then exit openCard
iphoneControlCreate "multiline"
put the result into inputID
iphoneControlSet inputID, "rect", the rect of grc 2
iphoneControlSet inputID, "visible", "true"
iphoneControlSet inputID, "opaque", "false"
iphoneControlSet inputID, "fontName", "Helvetica"
iphoneControlSet inputID, "fontSize", 18
iphoneControlSet inputID, "textColor", "0,0,0"
iphoneControlSet inputID, "borderStyle", "none"
--iphoneControlSet inputID, "clearButtonMode", "unless editing"
iphoneControlSet inputID, "autoCapitalizationType", "sentences"
iphoneControlSet inputID, "autoCorrectionType", "Yes"
iphoneControlSet inputID, "autoClear", "true"
iphoneControlSet inputID, "text", MyVarText
end openCard
on closeCard
iphoneControlDelete inputID
end closeCard
on inputBeginEditing
--put iphonecontrolGet(inputID, "text") into fld 1
--iphoneControlSet inputID, "textColor", "0,0,0"
end inputBeginEditing
on inputTextChanged
--iphoneControlSet inputID, "textColor", "0,0,0"
--put iphonecontrolGet(inputID, "text") into fld 1
end inputTextChanged
on inputEndEditing
put iphonecontrolGet(inputID, "text") into fld 1
put iphonecontrolGet(inputID, "text") into MyVarText
iphoneControlSet inputID, "textColor", "0,0,0"
--answer iphonecontrolGet(inputID, "text")
end inputEndEditing
This is the button script
Code: Select all
on touchStart pId
mobGUITouch the long id of me
end touchStart
on mouseDown
if the environment = "development" then touchStart 1
close stack "Text To Analyze"
open stack "Objective"
focus on nothing
end mouseDown
Code: Select all
on preOpenCard
# mobGUIStart ---> Inserted by mobGUI plugin
if "MobGUILib-1365522214984.464844" is not among the lines of the stacksInUse then start using stack "MobGUILib-1365522214984.464844"
mobGUIPreOpenCard me
# mobGUIEnd
end preOpenCard
global MyVarText
on openCard
Put MyVarText into field "Field o"
focus on nothing
end openCard