x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Slate's virtual keyboard not showing up

Hi,

I am trying to make the built-in virtual keyboard show up, but haven't succeeded yet. I have a HUD class in C++ that extends from UUserWidget and that has a Blueprint subclass where higher level elements are set up. There I have an EditableTextBox (the UMG subclass of UEditableTextBox) that I want to link with the built-in virtual keyboard (so that when the editable text box has the focus the virtual keyboard is popped up).

To make the virtual keyboard show up, according with the C++ API, we must call FSlateApplication's ShowVirtualKeyboard function.

I've set up a function in my HUD class to show the virtual keyboard, but it isn't working yet. This is a version of the function that takes no parameters. It is reached (checked with debugging), but doesn't show the keyboard on the screen. Notice that this doesn't pass a widget to receive the keyboard's input, which is an optional parameter for the FSlateApplication's function (when nullptr is passed, it just creates the widget internally).

 void MyHUD::ShowVirtualKeyboard()
 {
     FSlateApplication::Get().ShowVirtualKeyboard(true, 0/*optional text entry slate widget parameter is nullptr, so the function will internally create one*/);
 }

This is another version of the function, in which I pass an EditableTextBox widget from UMG to link it to the virtual keyboard. The code below casts the passed UMG widget down to a Slate's text entry widget, the required type of argument. It doesn't show the virtual keyboard neither, it compiles fine but it crashes the Editor (saying that there are not enough debug symbols to tell the exact place where SlateCore crashed; the logs do not give any useful information neither). I am a bit of a newbie with dealing with shared pointers (required in the FSlateApplication's function call), but the debugger doesn't show any nullptr in these lines that would make obvious what the crash reason is (can't debug the internal SlateCore code to track down the crash cause).

 void MyHUD::ShowVirtualKeyboard(UWidget* TextEntryWidget)
 {
     TSharedPtr<SWidget> WidgetSharedPtr = TextEntryWidget->TakeWidget();
 
     SWidget* WidgetPtr = WidgetSharedPtr.Get();
 
     SVirtualKeyboardEntry* VirtualKeyboardEntryPtr = (SVirtualKeyboardEntry*)WidgetPtr;
 
     IVirtualKeyboardEntry* IVirtualKeyboardEntryPtr = (IVirtualKeyboardEntry*)VirtualKeyboardEntryPtr;
 
     FSlateApplication::Get().ShowVirtualKeyboard(true, 0, MakeShareable(IVirtualKeyboardEntryPtr));
 }

Do you have any guesses on why the virtual keyboard isn't showing up in neither of the two versions of the functions or why it might be crashing in the second one?

Thank you.

Product Version: UE 4.18
Tags:
more ▼

asked Jan 20 '18 at 03:35 PM in C++ Programming

avatar image

SomeRandomDev
23 2 4 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question