Exposing UE delegates and events to DataEventTrigger
Hey guys,
I followed the documentation to create a DataEventTrigger calling SetFocusAction on a button, whenever an event is raised on the viewmodel. In the blend project all is working as intended.
The xaml snippet:
The view model:
And the actual event call from the xaml code behind
If I run it in blend, the focus is set on the third button as expected.
But then I went on recreating the viewmodel in our UE5 c++ project and can't figure out what type to use for "RequestEvent". I tried declaring various UE event types (DECLARE_EVENT(...) and such), but it seems they're not supported by the Noesis wrapper and using Noesis::EventHandler wouldn't even compile.
Any idea?
EDIT:
I spent some time studying and debugging the NoesisTypeClass source files to confirm that there's indeed no way to expose delegates or events to Noesis. Plus, I found out that when a DataEventTrigger gets registered it looks for an entry in the mEvents array. But never does the NoesisTypeClass code ever modify that array.
Maybe I'm still missing something...
I followed the documentation to create a DataEventTrigger calling SetFocusAction on a button, whenever an event is raised on the viewmodel. In the blend project all is working as intended.
The xaml snippet:
Code: Select all
<Style x:Key="ButtonStyle_Concept" TargetType="{x:Type Button}">
...
<Setter Property="noesis:StyleInteraction.Triggers">
<Setter.Value>
<noesis:StyleTriggerCollection>
...
<noesis:DataEventTrigger Source="{Binding}" EventName="RequestFocus">
<noesis:SetFocusAction />
</noesis:DataEventTrigger>
</noesis:StyleTriggerCollection>
</Setter.Value>
</Setter>
...
Code: Select all
public class ViewModel_ContentItemBase
{
...
public event System.EventHandler RequestFocus;
public void InvokeFocusRequest()
{
RequestFocus?.Invoke(this, System.EventArgs.Empty);
}
}
Code: Select all
void OnLoaded(object _sender, EventArgs _e)
{
ViewModel.ListItems[2].InvokeFocusRequest();
}
But then I went on recreating the viewmodel in our UE5 c++ project and can't figure out what type to use for "RequestEvent". I tried declaring various UE event types (DECLARE_EVENT(...) and such), but it seems they're not supported by the Noesis wrapper and using Noesis::EventHandler wouldn't even compile.
Any idea?
EDIT:
I spent some time studying and debugging the NoesisTypeClass source files to confirm that there's indeed no way to expose delegates or events to Noesis. Plus, I found out that when a DataEventTrigger gets registered it looks for an entry in the mEvents array. But never does the NoesisTypeClass code ever modify that array.
Maybe I'm still missing something...
Re: Exposing UE delegates and events to DataEventTrigger
Hello,
As you figured out, at the moment there's no support for it, but I'm looking into it. Could you please create a ticket for it?
I'm still looking into the issue, but the more likely scenario would be to expose multi cast delegate properties as events, as those can be declared both in C++ and in Blueprint.
As you figured out, at the moment there's no support for it, but I'm looking into it. Could you please create a ticket for it?
I'm still looking into the issue, but the more likely scenario would be to expose multi cast delegate properties as events, as those can be declared both in C++ and in Blueprint.
Re: Exposing UE delegates and events to DataEventTrigger
Hi, I just submitted a ticket: #2575
Let me know, if you need more specific info.
I agree, multi cast delegates would probably be the best option for this. And if it simplifies the implementation, I think parameterless delegates would be ok for now.
Let me know, if you need more specific info.
I agree, multi cast delegates would probably be the best option for this. And if it simplifies the implementation, I think parameterless delegates would be ok for now.
Re: Exposing UE delegates and events to DataEventTrigger
We integrated the patch linked with the bug ticket and it's working as expected. Thanks!
Re: Exposing UE delegates and events to DataEventTrigger
Thanks for the feedback! This will be officially available in 3.2.1
Who is online
Users browsing this forum: Bing [Bot] and 1 guest