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"

VirtualKeyboard : Sending Input to SEditableTextBox

Getting SEditableTextBox, and by extension SEditableText, to accept input pragmatically has been a challenge. More than it needs to be that's for sure. Hopefully I'm doing something wrong and it actually is straightforward. In summary, I have a class that inherits from UEditableTextBox that adds a function SendKey, which is called from a Blueprint that has a virtual keyboard displayed:

 .h
 UCLASS()
 class MYAPP_API UMyEditableTextBox : public UEditableTextBox
 {
     GENERATED_BODY()
 
 public:
 
     void SendKey(FKey Key);
 };
 
 
 .cpp
 void UMyEditableTextBox::SendKey(FKey Key)
 {
     if (MyEditableTextBlock.IsValid())
     {
         // Backspace
         if (Key == EKeys::BackSpace)
         {
             return;
         }
         else if (Key == EKeys::Left)
         {
             //FMoveCursor Args = FMoveCursor::Cardinal(ECursorMoveGranularity::Character, FIntPoint(0, -1), ECursorAction::MoveCursor);
             //EditableText->MoveCursor(Args);
             return;
         }
         else if (Key == EKeys::Right)
         {
             //FMoveCursor Args = FMoveCursor::Cardinal(ECursorMoveGranularity::Character, FIntPoint(0, 1), ECursorAction::MoveCursor);
             //EditableText->MoveCursor(Args);
             return;
         }
         else if (Key == EKeys::Tab)
         {
             return;
         }
         else if (Key == EKeys::Enter)
         {
             return;
         }
 
         if (!IsReadOnly)
         {
             FString c = Key.ToString();
             if (c.Equals(FString("SpaceBar")))
                 c = " ";
 
             FModifierKeysState InModifierKeys;
             uint32 InUserIndex = 0;
             bool bInIsRepeat = false;
 
             FCharacterEvent InCharacterEvent(*(const TCHAR*)(*c), InModifierKeys, InUserIndex, bInIsRepeat);
             FSlateApplication::Get().ProcessKeyCharEvent(InCharacterEvent);
         }
     }
 }


Unfortunately the control doesn't behave as one would expect. For instance:

  1. When IsCaretMovedWhenGainFocus = false; any input directed to the control is always at the first position

  2. Likewise, when IsCaretMovedWhenGainFocus = true; input is always appended to the last position

Additionally, you may notice that I tried to directly manipulate the SEditableText control via FMoveCursor. This is remnants of another attempt I tried to pragmatically manipulate the EditableText control. This attempt required that I redo the existing SEditableTextBox class and allow for access to the member variable, which was straightforward. However, I encountered a linker error with the FMoveCursor class, something that I could not resolve.

  1. How do I resolve the FMoveCursor linker error?

Can anyone help with any of these? Does anyone have any suggestions or better ideas on how to implementation this?

Any help is appreciated.

Product Version: UE 4.11
Tags:
more ▼

asked Apr 30 '16 at 12:40 AM in C++ Programming

avatar image

Jerry.Richards
168 11 17 30

(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