I’m creating a user input form that has a long list of text boxes.
The problem I have created is if I showKeyboard() to edit text in a box, the keyboard can cover over the text boxes I’m trying to edit.
I notice the code editor solves this by moving up the code being edited. Is this a public function I can also use?
What are possible solutions for a keyboard covering over the text field under edit?
Unfortunately that may then introduce a problem for input fields at top of the screen.
If the user is entering data in box at bottom then pushing text up is fine, if they are entering text at top, then the text box shouldn’t move up.
I’ll need to deal with both cases.
Problems like these really bloat my code
self.focus is set to true in touched if self was hit
-- move stuff around so keyboard doesn't cover it
posx = self.pos.x
posy = self.pos.y
if isKeyboardShowing() == true and self.focus == true then
--Highlight and center box under edit
fill(69, 206, 14, 255)
if isKeyboardShowing() == true and self.focus == false then
--grey out and move away box not under edit
fill(145, 156, 141, 255)
if posy-50<HEIGHT/2 then
@JakAttak I said, when checking a boolean. isKeyboardShowing() will never return nil (and it would make sense to be false if it was), and I don’t see how self.focus could be nil either (again, it would make sense to be false if it was).
@SkyTheCodee, I understand. I just wanted to make sure that @Famous knows all of this if he didn’t already know he could do it (in case later he uses it with a variable that could be nil and needs to recognize that specifically)
@Saturn031000 I used to write in C and I always used 0 for false and non 0 for true. @JakAttak It’s good to know exactly how things work to avoid coding problems, especially when you’re coming from a different language.