Force Input Control to Enter Edit Mode
Posted: Sun Jun 30, 2013 1:46 am
Forum,
I have a basic Android Input Control question.
I have set up a card with several input field. In each of the fields I have the following code and are set to Focus-able with Text Locked.
on touchStart pID
put the long id of me into tName
put the text of me into tContent
inputCreatorWide "firstInput", "input", tName, tContent, "alphabet", "words", "no", "Done", ""
end touchStart
inputCreatorWide is a method in the card as follows. (for some reason the CODE button does not work)
on inputCreatorWide pName, pKind, pFld, pContent, pKeyboardType, pAutoCap, pAutoCorrect, pReturn, pDataDetect
if pFld contains "stack" then
put wordOffset("stack",pFld) into tWord
put word 1 to (tWord -2) of pFld into pFld
end if
put the rect of pFld into tSize
put the height of pFld into tHeight
set the itemdel to ","
add tHeight to item 4 of tSize -- Double the field size
mobileControlCreate pKind, pName
mobileControlSet pName, "rect", tSize -- standard for all controls
mobileControlSet pName, "visible", "True" -- standard for all controls
mobileControlSet pName, "text", pContent -- standard for all controls
mobileControlSet pName, "fontSize", 9
mobileControlSet pName, "textAlign", "left"
mobileControlSet pName, "keyboardType", pKeyboardType
mobileControlSet pName, "autoCapitalizationType", pAutoCap
mobileControlSet pName, "autoCorrectionType", pAutoCorrect
if pReturn is not Empty then
mobileControlSet pName, "returnKeyType", pReturn
else
mobileControlSet pName, "returnKeyType", "default"
end if
mobileControlSet pName, "contentType", "plain"
mobileControlSet pName, "editable", "TRUE"
mobileControlSet pName, "scrollingEnabled", "TRUE"
end inputCreatorWide
I has have a RETURN key handler that places the text that the user entered into the field and deletes the Input Control for that field.
on inputReturnKey
put mobileControlTarget() into tTarget
put mobileControlGet( tTarget, "text" ) into tInputValue
mobileControlDelete tTarget
switch tTarget
case "firstInput"
put tInputValue into fld "FirstName"
break
case "lastInput"
put tInputValue into fld "LastName"
break
end switch
end inputReturnKey
on inputBeginEditing
end inputBeginEditing
on inputTextChanged
end inputTextChanged
on inputEndEditing
put mobileControlTarget() into tTarget
mobileControlDelete tTarget
end inputEndEditing
This is the PROBLEM.
When the user selects the Input Field the Input Control is created and a white box is drawn in the specified area. The user then needs to touch the input area to put it in EDIT mode. If they touch somewhere else another input control can be created.
I want to put the user directly into EDIT mode when the Input Control is created. Then if they leave the control it gets the InputEndEditing message and is deleted.
I must be missing something simple. I tried to PASS the TouchStart message, that didn't help.
Thanks for the help.
I have a basic Android Input Control question.
I have set up a card with several input field. In each of the fields I have the following code and are set to Focus-able with Text Locked.
on touchStart pID
put the long id of me into tName
put the text of me into tContent
inputCreatorWide "firstInput", "input", tName, tContent, "alphabet", "words", "no", "Done", ""
end touchStart
inputCreatorWide is a method in the card as follows. (for some reason the CODE button does not work)
on inputCreatorWide pName, pKind, pFld, pContent, pKeyboardType, pAutoCap, pAutoCorrect, pReturn, pDataDetect
if pFld contains "stack" then
put wordOffset("stack",pFld) into tWord
put word 1 to (tWord -2) of pFld into pFld
end if
put the rect of pFld into tSize
put the height of pFld into tHeight
set the itemdel to ","
add tHeight to item 4 of tSize -- Double the field size
mobileControlCreate pKind, pName
mobileControlSet pName, "rect", tSize -- standard for all controls
mobileControlSet pName, "visible", "True" -- standard for all controls
mobileControlSet pName, "text", pContent -- standard for all controls
mobileControlSet pName, "fontSize", 9
mobileControlSet pName, "textAlign", "left"
mobileControlSet pName, "keyboardType", pKeyboardType
mobileControlSet pName, "autoCapitalizationType", pAutoCap
mobileControlSet pName, "autoCorrectionType", pAutoCorrect
if pReturn is not Empty then
mobileControlSet pName, "returnKeyType", pReturn
else
mobileControlSet pName, "returnKeyType", "default"
end if
mobileControlSet pName, "contentType", "plain"
mobileControlSet pName, "editable", "TRUE"
mobileControlSet pName, "scrollingEnabled", "TRUE"
end inputCreatorWide
I has have a RETURN key handler that places the text that the user entered into the field and deletes the Input Control for that field.
on inputReturnKey
put mobileControlTarget() into tTarget
put mobileControlGet( tTarget, "text" ) into tInputValue
mobileControlDelete tTarget
switch tTarget
case "firstInput"
put tInputValue into fld "FirstName"
break
case "lastInput"
put tInputValue into fld "LastName"
break
end switch
end inputReturnKey
on inputBeginEditing
end inputBeginEditing
on inputTextChanged
end inputTextChanged
on inputEndEditing
put mobileControlTarget() into tTarget
mobileControlDelete tTarget
end inputEndEditing
This is the PROBLEM.
When the user selects the Input Field the Input Control is created and a white box is drawn in the specified area. The user then needs to touch the input area to put it in EDIT mode. If they touch somewhere else another input control can be created.
I want to put the user directly into EDIT mode when the Input Control is created. Then if they leave the control it gets the InputEndEditing message and is deleted.
I must be missing something simple. I tried to PASS the TouchStart message, that didn't help.
Thanks for the help.