Managing UI Hit-Boxes / Focus in UE4
Posted: 20 Feb 2019, 21:27
Hello and thanks for your time,
I've been struggling finding a way to deal with the UI consuming mouse events in UE4. if anyone could give me suggestions on how to approach this issue:

There's a sphere on the scene which should respond to a mouse over event and I've added a NoesisInstance to the viewport which should also receive input events from the mouse. The sphere responds to mouse over events only if the NoesisIsntance is not added to viewport.
The issue i'm having is that the presence of the NoesisInstance is preventing the sphere from receiving the mouse-over event as if there is an overlay stretched across the entire screen. I've been looking into sizing the UserWidget element so that the frame of the widget could be the boundary for the hit test but I can't find out how to access this. Looking at the C++ for for NoseisInstance class it seems to have code to autosize itself to the size of the XAML but I'm not sure how to trigger this.
An example of the game usage would be a UI element for each party member on the side of the screen. Party members could be clicked on in the world to select but also clicking on their party frame element would also select them. Both the world or the UI would be selectable depending on what the mouse is over.
The XAML:
Thanks for the help!
I've been struggling finding a way to deal with the UI consuming mouse events in UE4. if anyone could give me suggestions on how to approach this issue:

There's a sphere on the scene which should respond to a mouse over event and I've added a NoesisInstance to the viewport which should also receive input events from the mouse. The sphere responds to mouse over events only if the NoesisIsntance is not added to viewport.
The issue i'm having is that the presence of the NoesisInstance is preventing the sphere from receiving the mouse-over event as if there is an overlay stretched across the entire screen. I've been looking into sizing the UserWidget element so that the frame of the widget could be the boundary for the hit test but I can't find out how to access this. Looking at the C++ for for NoseisInstance class it seems to have code to autosize itself to the size of the XAML but I'm not sure how to trigger this.
An example of the game usage would be a UI element for each party member on the side of the screen. Party members could be clicked on in the world to select but also clicking on their party frame element would also select them. Both the world or the UI would be selectable depending on what the mouse is over.
The XAML:
Code: Select all
<UserControl x:Class="MainWindow.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MainWindow"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Width="200" Height="200">
<UserControl.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="#FF3E5191" Offset="1"/>
</LinearGradientBrush>
</UserControl.Background>
<TextBlock x:Name="textBlock" Margin="23.283,112.1,23.283,65.762" TextWrapping="Wrap" Text="Box for testing Hit-Tests" Width="153.434" TextAlignment="Center" FontWeight="Bold"/>
</UserControl>