We have a bunch of buttons in our in-game HUD that you can press to build stuff. Essentially, you press the button, and it starts “sticky-dragging” a building (it’s a strategy game).
We recently added functionality to allow you to do “quick placement mode” by holding down the Shift key. If you hold down shift, then the building you’re sticky-dragging is supposed to stay in sticky-drag mode so you can place multiple instances of it.
That’s the theory. In practice, we’re finding that whether or not this works depends on whether you start pressing Shift before or after clicking the button with the mouse! Holding down Shift before clicking the Slate button causes it to ignore the Shift key. If you work until after you’ve clicked on the button with the mouse, it works fine.
Our code simply checks this:
if( IsInputKeyDown( EKeys::LeftShift ) )
{
// multi-placement mode …
}
… but Slate is somehow stealing the keyboard event from us at the moment you click the Slate button with the mouse, even though we’re not doing anything with the keyboard focus or anything like that.
Even commenting out the call to
FSlateApplication::Get().SetKeyboardFocus(SharedThis(this));
at initialization has no effect.
We’re planning on removing Slate from our codebase soon, but in the meantime, is there a good way to work around this?