UE4 version:4.22.3
I am making a plugin based on the SGraphEditor.I need to do something when user focused on the graph.I create the SGraphEditor like this
SGraphEditor::FGraphEditorEvents InEvents;
InEvents.OnSelectionChanged = SGraphEditor::FOnSelectionChanged::CreateSP(this,&FTestGraphAssetEditor::OnSelectedNodesChanged);
InEvents.OnNodeDoubleClicked = FSingleNodeEvent::CreateSP(this,&FTestGraphAssetEditor::OnNodeDoubleClicked);
InEvents.OnTextCommitted = FOnNodeTextCommitted::CreateSP(this,&FTestGraphAssetEditor::OnNodeTitleCommitted);
InEvents.OnFocused = SGraphEditor::FOnFocused::CreateSP(this,&FTestGraphAssetEditor::OnFocused);
return SNew(SGraphEditor)
.AdditionalCommands(GraphEditorCommands)
.IsEditable(true)
.Appearance(AppearanceInfo)
.GraphToEdit(EditingGraph->EdGraph)
.GraphEvents(InEvents)
.AutoExpandActionMenu(true)
.ShowGraphStateOverlay(false);
The OnFocused fuction will called only when I clicked middle mouse button on the graph,but the root class function’SWidget::OnFocusReceived(const FGeometry& MyGeometry, const FFocusEvent& InFocusEvent)’ will called as soon as focued on the graph.
I think they are the same action,but there are actually called in different different way.