hello.
Report one bug.
This problem occurs when “Use Mouse for Touch” is checked in the Input - Mouse Properties category of Project Settings.
Use Mouse for Touch uses OnTouchStarted() and OnTouchEnded() instead of OnMouseButtonDown() and OnMouseButtonUp() in SObjectTableRow.h.
But in OnTouchEnded(), when SelectionMode is SingleToggle, it behaves differently than OnMouseButtonDown().
In OnTouchEnded(), unlike OnMouseButtonDown(), OwnerTable->Private_ClearSelection() is not called, so OnItemSelectionChanged() in DetectItemSelectionChanged() cannot be called.
Below is the original code.
virtual FReply OnTouchEnded(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override
{
FReply Reply = SObjectWidget::OnTouchEnded(MyGeometry, InTouchEvent);
if (bProcessingSelectionTouch)
{
bProcessingSelectionTouch = false;
TSharedRef<ITypedTableView<ItemType>> OwnerTable = OwnerTablePtr.Pin().ToSharedRef();
if (const ItemType* MyItemPtr = GetItemForThis(OwnerTable))
{
ESelectionMode::Type SelectionMode = GetSelectionMode();
if (SelectionMode != ESelectionMode::None)
{
const bool bIsSelected = OwnerTable->Private_IsItemSelected(*MyItemPtr);
if (!bIsSelected)
{
if (SelectionMode != ESelectionMode::Multi)
{
OwnerTable->Private_ClearSelection();
}
OwnerTable->Private_SetItemSelection(*MyItemPtr, true, true);
OwnerTable->Private_SignalSelectionChanged(ESelectInfo::OnMouseClick);
Reply = FReply::Handled();
}
else if (SelectionMode == ESelectionMode::SingleToggle || SelectionMode == ESelectionMode::Multi)
{
OwnerTable->Private_SetItemSelection(*MyItemPtr, true, true);
OwnerTable->Private_SignalSelectionChanged(ESelectInfo::OnMouseClick);
Reply = FReply::Handled();
}
}
if (OwnerTable->Private_OnItemClicked(*MyItemPtr))
{
Reply = FReply::Handled();
}
}
}
return Reply;
}
I modified it as below.
virtual FReply OnTouchEnded(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override
{
FReply Reply = SObjectWidget::OnTouchEnded(MyGeometry, InTouchEvent);
if (bProcessingSelectionTouch)
{
bProcessingSelectionTouch = false;
TSharedRef<ITypedTableView<ItemType>> OwnerTable = OwnerTablePtr.Pin().ToSharedRef();
if (const ItemType* MyItemPtr = GetItemForThis(OwnerTable))
{
ESelectionMode::Type SelectionMode = GetSelectionMode();
if (SelectionMode != ESelectionMode::None)
{
const bool bIsSelected = OwnerTable->Private_IsItemSelected(*MyItemPtr);
if (!bIsSelected)
{
if (SelectionMode != ESelectionMode::Multi)
{
OwnerTable->Private_ClearSelection();
}
OwnerTable->Private_SetItemSelection(*MyItemPtr, true, true);
OwnerTable->Private_SignalSelectionChanged(ESelectInfo::OnMouseClick);
Reply = FReply::Handled();
}
else if (SelectionMode == ESelectionMode::SingleToggle || SelectionMode == ESelectionMode::Multi)
{
OwnerTable->Private_ClearSelection();
if (SelectionMode == ESelectionMode::Multi &&
OwnerTable->Private_GetNumSelectedItems() > 1 &&
OwnerTable->Private_IsItemSelected(*MyItemPtr))
{
OwnerTable->Private_SetItemSelection(*MyItemPtr, true, true);
}
OwnerTable->Private_SignalSelectionChanged(ESelectInfo::OnMouseClick);
Reply = FReply::Handled();
}
}
if (OwnerTable->Private_OnItemClicked(*MyItemPtr))
{
Reply = FReply::Handled();
}
}
}
return Reply;
}
Please check with the Epic team.
thank you