DominikRuta
Topic Author
Posts: 7
Joined: 19 Dec 2023, 15:03

[UE5] Double-click needed to select item in Listbox. Single-click does not work.

01 Oct 2024, 12:47

Hello, I have the following Listbox control with some items, where after I select item, I want it to be visually visible.
<ListBox>
	<ListBoxItem>Item 1</ListBoxItem>
	<ListBoxItem>Item 2</ListBoxItem>
	<ListBoxItem>Item 3</ListBoxItem>
	<ListBoxItem>Item 4</ListBoxItem>
	<ListBox.Style>
		<Style TargetType="{x:Type ListBox}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border Background="{StaticResource TransparentWhite}">
							<ItemsPresenter />
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</ListBox.Style>
	<ListBox.ItemContainerStyle>
		<Style TargetType="{x:Type ListBoxItem}">
			<Setter Property="Foreground" Value="Red" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border Background="{StaticResource TransparentWhite}">
							<ContentPresenter />
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="ContentTemplate">
					<Setter.Value>
						<DataTemplate>
							<Grid Background="Green" Margin="5" Focusable="False">
								<TextBlock Focusable="False" Text="{Binding}" Style="{StaticResource Style.Text.T1}" Foreground="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" />
							</Grid>
						</DataTemplate>
					</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsSelected" Value="True">
					<Setter Property="Foreground" Value="Yellow" />
				</Trigger>
			</Style.Triggers>
		</Style>
	</ListBox.ItemContainerStyle>
</ListBox>
Selecting the item worked as expected on first left button click, but after latest Noesis update 3.2.4, I have to double click in order to select the item. Right-click works fine. I've noticed that UNoesisInstance::NativeOnMouseButtonUp triggers only after the second click, not the first click. We are using FInputModeGameAndUI input mode and for instance casual buttons or items in ItemsControl works fine on the first click. If I switch to FInputModeUIOnly it works fine, but majority of the other UI stuff don't, so its no-go for me.

Any idea what could be wrong here?
 
User avatar
hcpizzi
Site Admin
Posts: 342
Joined: 09 Feb 2012, 12:40

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

02 Oct 2024, 10:07

Hello,

I think this may be related to a know issue introduced in Noesis SDK 3.2.4. Could you please create a ticket on our bug tracker and paste the link, so I can send you a patch?

Thank you!
 
User avatar
Ricardo
Posts: 6
Joined: 02 Jul 2024, 17:19
Contact:

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

07 Oct 2024, 05:43

Just as a simple contribution, since Xamltoy is still working with Noesis 3.1, I've pasted the code above there, and everything worked fine as well — after some cleaning of resources, but nevermind.
 
DominikRuta
Topic Author
Posts: 7
Joined: 19 Dec 2023, 15:03

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

07 Oct 2024, 17:06

I've fixed the issue by applying your revision 14284.
 
User avatar
hcpizzi
Site Admin
Posts: 342
Joined: 09 Feb 2012, 12:40

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

09 Oct 2024, 15:04

That was the change I was referring to, glad it solved you issue, and sorry I didn't get back to you earlier.
 
DominikRuta
Topic Author
Posts: 7
Joined: 19 Dec 2023, 15:03

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

10 Oct 2024, 11:47

It solved the issue. However, unfortunately, It introduced another problem. There is an issue when switching from mouse to gamepad controller while having open some screen with list. It looks like the focus is lost from the entire screen and I can't navigate through the list using d-pads. It seems that core of the problem are UNoesisInstance::NativeOnMouseEnter and UNoesisInstance::NativeOnMouseLeave. If I revert changes in these functions, double-click issue is back again, but the problem with the focus is gone and vice-versa.
 
User avatar
hcpizzi
Site Admin
Posts: 342
Joined: 09 Feb 2012, 12:40

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

10 Oct 2024, 11:59

Have you set SetUserFocusToViewport to true? You probably don't need that. When true, it gives focus to the game Viewport. It's there for a very specific use case.

If you haven't set it to true, could you please update the ticket with repro steps?

Thanks!
 
DominikRuta
Topic Author
Posts: 7
Joined: 19 Dec 2023, 15:03

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

16 Oct 2024, 12:26

I've updated the ticket. Again, we tried to fix the issue and came up with the "temporal" solution to deal with both issues. After using the above mentioned revision, we then updated Noesisinstance.ccp:
  • Reverting UNoesisInstance::NativeOnMouseEnter and UNoesisInstance::NativeOnMouseLeave overrides
  • In UNoesisInstance::NativeOnMouseButtonDown we changed "if (Handled && Hit)" condition to "if (Hit)"
Now ListBox item can be selected by using single-click and focus is not lost when using gamepad controller.
 
User avatar
hcpizzi
Site Admin
Posts: 342
Joined: 09 Feb 2012, 12:40

Re: [UE5] Double-click needed to select item in Listbox. Single-click does not work.

17 Oct 2024, 13:04

There's an additional change for the SDK at revision 14337, that affects the behavior of ListBoxItems. Could you try that change along with the plugin code without modification?

Thanks!

Who is online

Users browsing this forum: No registered users and 1 guest