Page MenuHomeFeedback Tracker

Listbox SCR_ListBoxComponent::SetItemSelected doesn't set m_iCurrentItem
Acknowledged, NormalPublic

Description

Hi,
Not setting SCR_ListBoxComponent::m_iCurrentItem when using SCR_ListBoxComponent::SetItemSelected is something intended or a bug?
I'm asking this because i'm preselecting the first item in the listbox after populating it. Although, after that if I select any other item (using cursor) the item that I've selected toggles to selected (thats ok) but the preselected item is still selected (visually).
As far as I've seen it is because OnItemClick needs m_iCurrentItem to be greater or equal than 0 to toggle it, and that happens only after the first selection using the cursor.

Details

Severity
Tweak
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
Windows 10 Pro 21H2 (19044.2728)
Category
General
Steps To Reproduce

Video
https://youtu.be/Gz2zEcHinic

Test Project

Event Timeline

Geez changed the task status from New to Assigned.Apr 12 2023, 12:06 PM
Geez changed the task status from Assigned to Acknowledged.Apr 13 2023, 12:40 PM
Geez assigned this task to bi_saveliy.Apr 13 2023, 12:44 PM

Hi, thanks for the report and for the provided test project.
It's a bug indeed, we will fix it.

Until the fix is deployed, you can use this as a workaround:

modded class SCR_ListBoxComponent
{
	override protected void _SetItemSelected(int item, bool selected, bool invokeOnChanged)
	{
		if (!m_bMultiSelection && selected)
			m_iCurrentItem = item;
		
		super._SetItemSelected(item, selected, invokeOnChanged);
	}
}

Hi, perfect!!!. thanks.