Skip to main content
Dejan Nedeljkovic
Associate III
September 11, 2019
Solved

Open keyboard when pressing on textArea?

  • September 11, 2019
  • 6 replies
  • 1189 views

Hi

Is there a solution to open a keyboard when pressing on a textArea?

Now I have implemented a flexButton and a textArea above that button. By clicking on the text/button the keyboard is popping up. If you have lots of textAreas that's too much work.

Regards

Dejan

This topic has been closed for replies.
Best answer by ihsanoglu

I am not sure I got your problem correctly. But try invalidating the entire view.

6 replies

ihsanoglu
Senior
September 11, 2019

Would you please share more details to offer you help?

Are you clicking on a flexButton object or a TextArea object ? You can assign all objects to one eventHandler

Dejan Nedeljkovic
Associate III
September 11, 2019

I'm clicking on the flexButton object and it works fine.

I've tried the textArea with a ClickListener. I've used this https://touchgfx.zendesk.com/hc/en-us/articles/360002825452-Mixins-and-ClickListener as example.

There is a weird behavior, when I'm clicking on the textArea object. The ClickHandler is working fine, but it doesn't open the keyboard properly. I need to click anywhere on the screen and only then the keyboard is opening.

I call the same function with the flexButton and textArea Handler.

Here is a snippet of the code:

#include <gui/screen2_screen/Screen2View.hpp>
 
Screen2View::Screen2View() :
 TextAreaClickedCallback(this, &Screen2View::TextArea2ClickHandler)
{
 
}
 
void Screen2View::setupScreen()
{
 Screen2ViewBase::setupScreen();
 textArea2.setClickAction(TextAreaClickedCallback);
}
 
void Screen2View::tearDownScreen()
 
{
 Screen2ViewBase::tearDownScreen();
}
 
 
void Screen2View::showKeyboard()
{
 keyboard.setPosition(0, 0, HAL::DISPLAY_WIDTH, HAL::DISPLAY_HEIGHT);
 add(keyboard);
}
 
 
void Screen2View::onButtonCloseKeyboard()
{
 remove(keyboard);
}
 
void Screen2View::onFlexButton1()
{
 showKeyboard();
}
 
 
void Screen2View::onFlexButton2()
{
 showKeyboard();
}
 
 
void Screen2View::TextArea2ClickHandler(const TextAreaWithOneWildcard& t, const ClickEvent& e)
{
 if((&t == &textArea2))
 {
 showKeyboard();
 }
}

ihsanoglu
ihsanogluBest answer
Senior
September 11, 2019

I am not sure I got your problem correctly. But try invalidating the entire view.

Dejan Nedeljkovic
Associate III
September 12, 2019

Hi @Abdullah İhsanoğlu​ 

I have another question. How did you manage to close the keyboard?

I would like to close by pressing on the enter button I added to CustomKeyboard.

I have no idea how I can get it working, because I need to close it from the screenView object.

Regards

Dejan