Hi, the problem is that SCompoundWidget triggering OnMouseLeave event when mouse touches top or left sides of the viewport, but still in the viewport.
Please, help me fix that.
Here is a code of widget:
STest.h:
class CLOSETHEGATE_API STest : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(STest)
{}
SLATE_END_ARGS()
void Construct(const FArguments& InArgs);
virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
};
STest.cpp:
void STest::Construct(const FArguments& InArgs)
{
ChildSlot
.VAlign(VAlign_Fill)
.HAlign(HAlign_Fill)
[
CONTENT
];
}
void STest::OnMouseLeave(const FPointerEvent& MouseEvent)
{
UE_LOG(LogTemp, Error, TEXT("Out of widget"));
}
And somwhere in HUD created instance of the STest widget:
if (GEngine)
{
GEngine->GameViewport->AddViewportWidgetContent
(
SNew(SWeakWidget)
.PossiblyNullContent(STest_VARIABLE.ToSharedRef())
);
}
STest_VARIABLE->SetVisibility(EVisibility::Visible);
So, with this code, when you touches left or top sides of window you will get “Out of widget” error in log.