iOS text field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: iOS text field
Hi Nakia,
I think it is a design decision and what you feel comfortable with.
Design decision regarding how you want to interact with your users and what they
You could also very well just use one native input field and set its rect on the fly and controlling the type of keyboard. This could be done on a locked field that is not focusable in a mousedown handler. There you would overlay the input field over the text field, let the user type his input. When the user is done you transfer the text to the destination field and hide the native input controller.
It is probably a little less code if you use only one native input control.
I find it difficult to give advice because all approaches work and depend on personal preferences and specific circumstances. In your case as I understand especially that you want numeric input into the third field only. Though there are ways to control for numbers only with a Livcode field.
Kind regards
Bernd
I think it is a design decision and what you feel comfortable with.
Design decision regarding how you want to interact with your users and what they
You could also very well just use one native input field and set its rect on the fly and controlling the type of keyboard. This could be done on a locked field that is not focusable in a mousedown handler. There you would overlay the input field over the text field, let the user type his input. When the user is done you transfer the text to the destination field and hide the native input controller.
It is probably a little less code if you use only one native input control.
I find it difficult to give advice because all approaches work and depend on personal preferences and specific circumstances. In your case as I understand especially that you want numeric input into the third field only. Though there are ways to control for numbers only with a Livcode field.
Kind regards
Bernd
Re: iOS text field
As you say I would prefer to use only one iOS text fld and be able to set its rect to the focus of the fld they have pressed but just can't seem to get in my head how to do this..
It seems that when I use the iOS text fld placed over the rect of the underlying text fld the text fld doesn't receive the press so using the focus or open fld handler won't work to apply any actions..
It seems that when I use the iOS text fld placed over the rect of the underlying text fld the text fld doesn't receive the press so using the focus or open fld handler won't work to apply any actions..
Re: iOS text field
think I am getting closer, but still one small bug I need to address...
If I am in one of the IOS Text fields and press into one of the other flds it doesn't send either of the termination messages to the current Text Field (as it is named the same as the new one that is created when I pressed into the new fld) if I press return or anywhere else it exists just fine and does what needed..
It seems I need to name each of them uniquely when created but how do I then use the inputEndEditing and inputReturnKey correctly as they don't seem to have an index of their origin?
this is what I ended up with in the fld scripts (below example of one), each places its object name into gUiTextField..
If I am in one of the IOS Text fields and press into one of the other flds it doesn't send either of the termination messages to the current Text Field (as it is named the same as the new one that is created when I pressed into the new fld) if I press return or anywhere else it exists just fine and does what needed..
It seems I need to name each of them uniquely when created but how do I then use the inputEndEditing and inputReturnKey correctly as they don't seem to have an index of their origin?
this is what I ended up with in the fld scripts (below example of one), each places its object name into gUiTextField..
below is the card script..on mouseDown
global gUiTextField
put "PilotName" into gUiTextField
UiTextField
end mouseDown
Code: Select all
on UiTextField
iphoneControlCreate "input"
put the result into inputID
--
iphoneControlSet inputID, "rect", the rect of fld gUiTextField
iphoneControlSet inputID, "visible", "true"
iphoneControlSet inputID, "opaque", "false"
iphoneControlSet inputID, "clearButtonMode", "unless editing"
iphoneControlSet inputID, "autoCapitalizationType", "none"
iphoneControlSet inputID, "autoCorrectionType", "No"
iphoneControlSet inputID, "autoClear", "false"
--
end UiTextField
on inputBeginEditing
put empty into fld gUITextField
end inputBeginEditing
on inputEndEditing
put iphoneControlGet (inputID, "text") into fld gUiTextField
iphoneControlDelete inputID
end inputEndEditing
on inputReturnKey
put iphoneControlGet (inputID, "text") into fld gUiTextField
iphoneControlDelete inputID
end inputReturnKey
Re: iOS text field
Hi Nakia,
if you use this it is maybe easier to name the controls when they are created instead of using the default id-number.
kind regards
Bernd
iPhoneControlTarget() will tell you which control issued the message. -> Dictionary.how do I then use the inputEndEditing and inputReturnKey correctly as they don't seem to have an index of their origin?
Code: Select all
put iPhoneControlTarget() into tWhoDidIt
kind regards
Bernd
Re: iOS text field
Okay,
I think you are right...
I will see how I go, been working on another portion tonight
I think you are right...
I will see how I go, been working on another portion tonight
Re: iOS text field
Hi Nakia,
I made a little stack that uses three iOS native input fields. The fields are created on preopencard and deleted on closeCard.
The size of the iOS field is determined by three hidden Livecode fields. (you can make them visible with a checkbox)
The input from the three iOS fields goes into 3 lines of a field "fEntries"
Line 1 is name
line 2 is surname
line 3 is ASAA number
you can redirect the input wherever you want, see comments in the code of the card script.
the field for the ASAA number checks for numbers. Right now it also accepts "/" and "-" in case these are alowable, change in script which characters are allowed, see comments.
Checking for numbers works ok unless someone pastes text into the field. If you want to change that I could rewrite that part.
Have a look
kind regards
Bernd
I made a little stack that uses three iOS native input fields. The fields are created on preopencard and deleted on closeCard.
The size of the iOS field is determined by three hidden Livecode fields. (you can make them visible with a checkbox)
The input from the three iOS fields goes into 3 lines of a field "fEntries"
Line 1 is name
line 2 is surname
line 3 is ASAA number
you can redirect the input wherever you want, see comments in the code of the card script.
the field for the ASAA number checks for numbers. Right now it also accepts "/" and "-" in case these are alowable, change in script which characters are allowed, see comments.
Checking for numbers works ok unless someone pastes text into the field. If you want to change that I could rewrite that part.
Have a look
kind regards
Bernd
Re: iOS text field
Thank you so much....
I will take a look and report back
I will take a look and report back

Re: iOS text field
this looks good so far..(have simplified down a little to start with)
One question though..
I am using this to place the information into its approriate fld which is working as required...
But i then have another script in a btn that takes the contents of these 3 LC flds and places them into another fld..how do I add to that script the ability to reset the values in each of the IOSTextFlds?
One question though..
I am using this to place the information into its approriate fld which is working as required...
Code: Select all
put iPhoneControlGet (tTarget, "text") into fld tTarget
Re: iOS text field
Hi Nakia,
here is a little command you place in the card script assuming the card script still has the same script local variables etc.
When you have put your data to its final destination you can issue a
in that same handler and it will empty the iOS input fields
kind regards
Bernd
here is a little command you place in the card script assuming the card script still has the same script local variables etc.
Code: Select all
on clearInputFields
repeat for each item anInputField in sFields
iPhoneControlSet anInputField, "text", ""
end repeat
end clearInputFields
Code: Select all
-- code that puts your data to final destination
clearInputFields
-- possibly more code
kind regards
Bernd
Re: iOS text field
Hi Kia,
why did you delete the post? Is the problem solved?
Anyways:
add "focus on nothing" and it should work.
Kind regards
Bernd
As noted earlier on each IOS Text Field places its contents in a LC text fld on end editing msg..this works fine if i press return or any where on the screen but doesn't work if i press button which activates another function whilst in IOS Text FLD.. I.E. there is a button on this card which takes the contents of the 3 LC Text Flds and places them into another fld..If i just press that button the IOS text fld doesn't send its endInput message and therefore doesnt place the data in the LC Text Fld..
why did you delete the post? Is the problem solved?
Anyways:
add "focus on nothing" and it should work.
Code: Select all
on addPilotDetails
focus on nothing -- this forces the keyboard to close and the inputEndEditing messages is sent
put "add Pilot" into field "fErr"
end addPilotDetails
Bernd
Re: iOS text field
Yep , solved it by changing the IOS Text fld to place the data into the field on the inputTextChanged message in place
Of inputEndEditing message.
I did try the focus on nothing in the button script but it didn't seem to work...
Thanks
Kia
Of inputEndEditing message.
I did try the focus on nothing in the button script but it didn't seem to work...
Thanks
Kia