本文整理汇总了C++中FReply::SetUserFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ FReply::SetUserFocus方法的具体用法?C++ FReply::SetUserFocus怎么用?C++ FReply::SetUserFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FReply
的用法示例。
在下文中一共展示了FReply::SetUserFocus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFocusReceived
FReply SDetailsViewBase::OnFocusReceived(const FGeometry& MyGeometry, const FFocusEvent& InFocusEvent)
{
FReply Reply = FReply::Handled();
if (InFocusEvent.GetCause() != EFocusCause::Cleared)
{
Reply.SetUserFocus(SearchBox.ToSharedRef(), InFocusEvent.GetCause());
}
return Reply;
}
示例2: OnButtonClicked
FReply SComboButton::OnButtonClicked()
{
// Button was clicked; show the popup.
// Do nothing if clicking on the button also dismissed the menu, because we will end up doing the same thing twice.
this->SetIsOpen( ShouldOpenDueToClick(), bIsFocusable );
// If the menu is open, execute the related delegate.
if( IsOpen() && OnComboBoxOpened.IsBound() )
{
OnComboBoxOpened.Execute();
}
// Focusing any newly-created widgets must occur after they have been added to the UI root.
FReply ButtonClickedReply = FReply::Handled();
if (bIsFocusable)
{
TSharedPtr<SWidget> WidgetToFocus = WidgetToFocusPtr.Pin();
if (!WidgetToFocus.IsValid())
{
// no explicitly focused widget, try to focus the content
WidgetToFocus = MenuContent;
}
if (!WidgetToFocus.IsValid())
{
// no content, so try to focus the original widget set on construction
WidgetToFocus = ContentWidgetPtr.Pin();
}
if (WidgetToFocus.IsValid())
{
ButtonClickedReply.SetUserFocus(WidgetToFocus.ToSharedRef(), EFocusCause::SetDirectly);
}
}
return ButtonClickedReply;
}
示例3: OnMouseButtonDown
FReply FTextEditHelper::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& InMouseEvent, const TSharedRef< ITextEditorWidget >& TextEditor )
{
FReply Reply = FReply::Unhandled();
// If the mouse is already captured, then don't allow a new action to be taken
if( !TextEditor->GetWidget()->HasMouseCapture() )
{
if( InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton ||
InMouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
// Am I getting focus right now?
const bool bIsGettingFocus = !TextEditor->GetWidget()->HasKeyboardFocus();
if( bIsGettingFocus )
{
// We might be receiving keyboard focus due to this event. Because the keyboard focus received callback
// won't fire until after this function exits, we need to make sure our widget's state is in order early
// Assume we'll be given keyboard focus, so load text for editing
TextEditor->LoadText();
// Reset 'mouse has moved' state. We'll use this in OnMouseMove to determine whether we
// should reset the selection range to the caret's position.
TextEditor->SetWasFocusedByLastMouseDown( true );
}
if( InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
if( InMouseEvent.IsShiftDown() )
{
TextEditor->MoveCursor( FMoveCursor::ViaScreenPointer( MyGeometry.AbsoluteToLocal( InMouseEvent.GetScreenSpacePosition( ) ), MyGeometry.Scale, ECursorAction::SelectText ) );
}
else
{
// Deselect any text that was selected
TextEditor->ClearSelection();
TextEditor->MoveCursor( FMoveCursor::ViaScreenPointer( MyGeometry.AbsoluteToLocal( InMouseEvent.GetScreenSpacePosition( ) ), MyGeometry.Scale, ECursorAction::MoveCursor ) );
}
// Start drag selection
TextEditor->BeginDragSelection();
}
else if( InMouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
// If the user right clicked on a character that wasn't already selected, we'll clear
// the selection
if ( TextEditor->AnyTextSelected( ) && !TextEditor->IsTextSelectedAt( MyGeometry, InMouseEvent.GetScreenSpacePosition() ) )
{
// Deselect any text that was selected
TextEditor->ClearSelection();
}
}
// Right clicking to summon context menu, but we'll do that on mouse-up.
Reply = FReply::Handled();
Reply.CaptureMouse( TextEditor->GetWidget() );
Reply.SetUserFocus(TextEditor->GetWidget(), EFocusCause::Mouse);
}
}
return Reply;
}