cancel
Showing results for 
Search instead for 
Did you mean: 

Open keyboard when pressing on textArea?

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6
ihsanoglu
Senior

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

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();
   }
}

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

Thank you very much. I had only to invalidate the keyboard.

Regards

Dejan

Glad I helped

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