raspberry-pi3wxwidgetsraspbianon-screen-keyboardwxtextctrl

What is the best way to invoke a onscreen keyboard when cursor placed on a wxTextCtrl?


I'm trying to design a GUI touch screen application using wxWidgets(version 3.0.4). The touch screen is working fine. I need to use the on screen keyboard to populate a text box(wxTextCtrl).

I've done some searching and I dont find any setfocus or getfocus functions available for the wxTextCtrl. Neither can I find any event that tells that a cursor is placed in the text field so that I can invoke a onscreen keyboard.

Is there any library available or do I need to implement my own version of the keyboard?


Solution

  • wxExecute function did the trick. I was able to successfully get the feedback in the wxwidget app from the key presses performed via the xvkbd. Sample code below:

    this->main_frame->text_field->Connect(wxEVT_SET_FOCUS,wxFocusEventHandler(InvokeKeyboard), NULL, this);
    
    void InvokeKeyboard(wxFocusEvent& event)
    {
        event.Skip();
        system("killall xvkbd 1>/dev/null 2>/dev/null");
        wxExecute(wxT("xvkbd > /dev/null 2>/dev/null"), wxEXEC_ASYNC | wxEXEC_NODISABLE | wxEXEC_HIDE_CONSOLE );
    }
    

    You can refer here for the detailed documentation of wxExecute