My app is getting to the point where it needs a way for users to chat with each other privately but because of all of the problems I've found with edit boxes I can't see it happening with AppGameKit which is disappointing as I love working with AGK. The other disappointing thing about it is that I prefer creating apps then games and there's not many decent/useful apps you can make without a textbox!
Anyway here's a list of all of the problems I've collated in the hope that one or two of them will one day be looked at and sorted. I was only able to test these on a Mac and an Android device.
*
ANDROID: Type in random keys without pressing space and then hold down the delete key and it will delete all characters until you let go. Great! Now type in random keys, press space, some more random keys and then hold down delete it will stop at the place where you added the space. It will delete the space but won’t continue. And now you can’t hold the delete key down anymore and have to press delete repeatedly for all characters in the first part of the text.
*
ANDROID: There’s no way of finding out the keyboard height so you can’t correctly position the edit box above the keyboard and be confident it will be the same on all devices. You have to position it because the keyboard covers it if you’ve got the edit box at the bottom of the screen. I know there’s SetEditBoxUseAlternateInput but…
*
ANDROID: SetEditBoxUseAlternateInput(index, 1) creates a very tiny textbox. Why doesn’t it have the same size and style we’ve set the edit box? Why not just position the edit box above the keyboard instead of creating a teeny weeny textbox that doesn’t fit in with any style?
*
MAC & ANDROID: Pressing enter doesn’t increase GetEditBoxLines() count until you start typing even though the cursor is on a new line. Was using this to autosize the edit box as they type like you’d see when typing in WhatsApp. If you press enter GetEditBoxLines should increase. Here's an example of an edit box that resizes with the number of lines. I couldn't do this on it's own: SetEditBoxSize(txtBox, 85, GetEditBoxLines(txtBox) * 5) because if the edit box is empty then GetEditBoxLines returns 0 so the size of the box ends up with a height of 0.
if (GetEditBoxLines(txtBox) >= 1)
SetEditBoxSize(txtBox, 85, GetEditBoxLines(txtBox) * 5)
else
SetEditBoxSize(txtBox, 85, 5)
endif
*
MAC: You can’t press the cursor keys in an edit box to move the cursor because it inserts square ascii characters instead of moving the cursor. I’ve raised this before and it will hopefully be fixed in the next version of AGK.
*
MAC & ANDROID: The cursor isn’t vertically centred. To make it look neat you have to remove borders and add a white sprite behind the edit box with an offset so that the cursor looks vertically centred. Yeah ok I'm probably being a bit picky here...
sprBox = CreateSprite(0)
SetSpriteColor(sprBox, 255, 255, 255, 255)
SetSpriteSize(sprBox, 85, 5)
SetSpritePosition(sprBox, 1, 93) // Positioned 1% higher than the edit box.
txtBox = CreateEditBox()
SetEditBoxSize(txtBox, 85, 5)
SetEditBoxPosition(txtBox, 1, 94)
SetEditBoxBorderSize(txtBox, 0)
*
ANDROID: Emojis show as a square ascii character.
*
ANDROID: There’s no default text option for when the textbox is empty. It’s easy enough to program though:
if (GetEditBoxHasFocus(txtBox))
if (GetEditBoxText(txtBox) = "Type a message")
SetEditBoxTextColor(txtBox, 0, 0, 0)
SetEditBoxText(txtBox, "")
endif
else
if (GetEditBoxText(txtBox) = "")
SetEditBoxTextColor(txtBox, 150, 150, 150)
SetEditBoxText(txtBox, "Type a message")
endif
endif
*
MAC & ANDROID: No alignment.
*
MAC & ANDROID: No select, copy and paste (but we all know this).
*
ANDROID: GetPointerPressed() doesn't register when the keyboard is showing so you can't have a button next to the text box that sends a message. Well you can but it takes two clicks to register the button was pressed and therefore send the message. Just remembered this one. This is another one I reported before and should hopefully be fixed in the next version of AGK.
Anything else I've missed?