playMaker

Author Topic: GUILayout text field: How do i tell it not to record "enter?"  (Read 7252 times)

Red

  • Hero Member
  • *****
  • Posts: 563
GUILayout text field: How do i tell it not to record "enter?"
« on: February 05, 2013, 01:27:07 PM »
I've gotten to the point where i have to get this GUI Done and the layout functions are working for the default style (i'll worry about the window dressing later.)

Thing is, the field i've set up using the GUILayout Text Field action is recording the enters... and i kinda don't want it to do that.

what solution would be recommended so taht when the player hits "enter" that it'll drop out of that field? i've tried the "key down" function to detect when the return/enter key is pressed but when it's in the field, it doesn't respond.

any suggestions on how to get this to stop letting the player use an enter/return in the field?

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #1 on: September 25, 2014, 02:26:59 AM »
I have run into this same problem right now.
I would like the GUILayout Text Field to be a single line entry field and not accept enters.
The GUILayout Password Field seems to be single line but has the Mask (*) character which I don't want.

If I remove the Mask then I get this error:
Code: [Select]
IndexOutOfRangeException: Array index is out of range.
HutongGames.PlayMaker.Actions.GUILayoutPasswordField.OnGUI () (at Assets/PlayMaker/Actions/GUILayoutPasswordField.cs:31)
PlayMakerGUI.DoEditGUI ()
PlayMakerGUI.OnGUI ()

Is it the Layout Options I should investigate to be able to modify the behavior of the text field?

Thanks,
szomaza

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #2 on: October 14, 2014, 01:39:02 AM »
Please help with any idea what I should try to get a virtual keyboard without the enter (just single line) OR the enter working as "end input".

Or can the masking character of the GUILayout Password Field be turned off?

Thanks in advance,
szomaza

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #3 on: October 14, 2014, 02:12:34 AM »
http://docs.unity3d.com/ScriptReference/TouchScreenKeyboardType.html
"NamePhonePad   Keypad designed for entering a person's name or phone number."

That could be good. I guess that is just a one line entry field.
How do I modify my text entry field so it uses this "TouchScreenKeyboardType" keypad type?

Could keyboard type to use be added to GUILayout Text Field?
https://hutonggames.fogbugz.com/default.asp?W436

Thanks,
szomaza

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #4 on: October 27, 2014, 05:57:58 AM »
Please give some ideas to help solve this.

Br,
szomaza

Twood

  • Junior Playmaker
  • **
  • Posts: 76
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #5 on: October 27, 2014, 11:09:34 AM »
Wow, I have the exact same problem here.

I'm making a typing game.

I finished all the logic. The words and stuff are set up with Arraymaker and that's all fine.

Only thing I don't like is enter doesn't work with the Gui Keyboard Event action I download.

It "works" but it adds a return character to the text field meaning a player would always have to backspace after a right answer! Even if you set the string to empty itself, the extra space goes in because the stupid default text field behavior.

So I changed the fire event to the up arrow as a dirty fix, but I still want to remove the default text field behavior of enabling returns. It messes up the game I'm making if a player accidentally uses enter. Plus I'd rather they could use enter without a problem anyway as their response key.
« Last Edit: October 27, 2014, 11:29:22 AM by Twood »

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #6 on: February 17, 2015, 03:10:44 AM »
Please help with this. See attached image with problem.

The 1st one is how the virtual keyboard appears when a Google search field is clicked.
That would be OK, as it is a one line entry and shows the typed text. (the magnifying glass I would not need of course, DONE would be better there)

The 2nd one is how the keyboard appears when using a GUILayout Text Field.
https://hutonggames.fogbugz.com/default.asp?W436
This is not good because it allows for multi line entry and has the enter/next line key.

The 3rd one is GUILayout Password field (please add an explanation for it to here: https://hutonggames.fogbugz.com/default.asp?W414)
This would be great as it only allows for one line and the DONE button finishes the entry, the only problem with this is that the text is masked.

Is the "Layout Options" in the GUILayout Text Field action something where one can enter some parameters to alter the virtual keyboard used?

Please help to solve this!

Thanks in advance,
szomaza

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #7 on: February 17, 2015, 03:36:43 AM »

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #8 on: February 18, 2015, 01:31:22 AM »
I just tried that, and it does not seem to do anything (what I would expect) when I press the enter key on the virtual keyboard that the GUILayout Text Field brings up.
In that case it just ads lines as it did before.

When I test with Unity Remote (I am only able to enter one character at a time from the PC keyboard as the virtual keyboard is not displayed) and in this case it does delete back that last character when I press Enter on the PC keyboard.
So it seems to do something, but nothing when it is built to and tested on device.

Anyway, even if it worked this would be such an ugly hack.
I would like to be able to use those virtual keyboards that other apps use
or simply just use the keyboard that is brought up by the GUILayout Password Field but be able to set the masking character to empty, so it does not mask the text.

Please make this possible.

Br,
szomaza

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #9 on: February 18, 2015, 04:01:09 AM »
Hi,

 the question would be first, does the action fires that event when you press the enter key on the virtual keyboard?

 if not, you'll need to find what is the exact keycode to catch, which is likely why it fails, you may have to listen to several different keycode to actually have a cross platform solution.

 so your first step is to make this action work, then you can take care on the content and display itself.

 Bye,

 Jean

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #10 on: February 19, 2015, 01:04:31 AM »
Thanks for the explanation, but exactly that is why I don't want to fool round with this hack. :-(
Just need a virtual keyboard without a new line possibility.
I am pretty sure this can be achieved with some coding wizardry.

It exists, just seems to be inaccessible by just using Playmaker actions.

- Google search field brings such keyboard up,
- Contacts search field is also one line (with a backspace button instead of a new line)
- all the contact detail field entries like name/address/etc. all have one liner virtual keyboards.

and also the GUILayout Password Field action's keyboard is perfect except for the character masking.

Br,
szomaza

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #11 on: February 19, 2015, 03:35:36 AM »
Hi,

 Sorry, I think I dont' understand what you want.

 Do you want to change the keyboard layout?  I think this is what you are after. Then I would first ask on Unity Forum, if it comes back with a script that effectivly gives you the keyboard you want, then let me know, I'll make an action out of this script.

Bye,

 Jean

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #12 on: February 19, 2015, 06:11:26 AM »
Ok, I'll search and ask there.

edit:
I found it:
http://docs.unity3d.com/Manual/MobileKeyboard.html
http://docs.unity3d.com/ScriptReference/TouchScreenKeyboard.Open.html

public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default, bool autocorrection = true, bool multiline = false, bool secure = false, bool alert = false, string textPlaceholder = "");

multiline   --   Can more than one line of text be entered?

So, I simply would like a keyboard with multiline disabled.
(Please also look at the image I posted in a prevoius reply.)

Currently we have actions for:
GUILayout Text Field
GUILayout Password

I would like a GUILayout Text Field (multiline=false)

Thanks in advance,
szomaza
« Last Edit: February 19, 2015, 06:31:42 AM by szomaza »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #13 on: February 24, 2015, 03:38:32 AM »
Hi,

 You can find and install the OpenKeyBoard custom action on the Ecosystem.

http://hutonggames.com/playmakerforum/index.php?topic=2316.msg30680#msg30680

 Bye,

 Jean

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: GUILayout text field: How do i tell it not to record "enter?"
« Reply #14 on: February 25, 2015, 01:37:10 AM »
Open Device Key Board action does not change anything.
I still get the same keyboard (when app running on Android) as before that has a new line button, when using the GUI Layout Text Field action.

Your proposed solution sounds like : "use this it will work" but it does not seem to change anything.
Am I missing something?

br,
szomaza

edit:
Oh wait! My Open Device Key Board action does not have any of the setting possibilities of the one shown in the screenshot, here:
http://hutonggames.com/playmakerforum/index.php?topic=2316.0

Mine is just a single line action without any settings.
I just downloaded it from the Ecosystem.

edit2:
OK, I see there is "#if UNITY_IPHONE" in the script, so none of it is executed when switched to Android.

What should I try to be able to test this on Android?
Just edit that to "#if UNITY_ANDROID"
:-)
« Last Edit: February 25, 2015, 01:50:51 AM by szomaza »