FValorActionInputBinding UInputBlueprintLibrary::K2_GetInputAction(const FKeyEvent& KeyEvent) { FValorActionInputBinding Binding; Binding.Key = KeyEvent.GetKey(); Binding.KeyAsString = Binding.Key.GetDisplayName().ToString(); Binding.bAlt = KeyEvent.IsAltDown(); Binding.bCtrl = KeyEvent.IsControlDown(); Binding.bShift = KeyEvent.IsShiftDown(); Binding.bCmd = KeyEvent.IsCommandDown(); return Binding; }
FReply SWidget::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent ) { if (SupportsKeyboardFocus()) { EUINavigation Direction = FSlateApplicationBase::Get().GetNavigationDirectionFromKey( InKeyEvent ); // It's the left stick return a navigation request of the correct direction if ( Direction != EUINavigation::Invalid ) { return FReply::Handled().SetNavigation( Direction ); } else if ( InKeyEvent.GetKey() == EKeys::Tab ) { //@TODO: Really these uses of input should be at a lower priority, only occurring if nothing else handled them // For now this code prevents consuming them when some modifiers are held down, allowing some limited binding const bool bAllowEatingKeyEvents = !InKeyEvent.IsControlDown() && !InKeyEvent.IsAltDown() && !InKeyEvent.IsCommandDown(); if (bAllowEatingKeyEvents) { EUINavigation MoveDirection = (InKeyEvent.IsShiftDown()) ? EUINavigation::Previous : EUINavigation::Next; return FReply::Handled().SetNavigation(MoveDirection); } } } return FReply::Unhandled(); }