I want to create a radar widget which positions SButtons relative to alloted geometry. I create canvas like this:
void SLocatorScreen::Construct(const FArguments& InArgs)
{
ChildSlot
[
SAssignNew( Canvas , SCanvas )
];
}
Then I add slot in tick function (in tick because I need FGeometry)
void SLocatorScreen::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
{
Canvas->ClearChildren();
Canvas->AddSlot().Position( AllottedGeometry.GetLocalSize() / 2 ).Size( FVector2D( 20, 20 ) )
[
SNew( SButton ).OnClicked( this, &SLocatorScreen::HostClick )
];
}
The button shows up but is inactive. Through widget reflector I can see that it is disabled.
I tried appending .IsEnabled(true) to SNew call but it has no effect. Anyone knows why this is happening? If I create a slot in Construct button shows up enabled as expected (but I cannot place it there since i need AllotedGeometry)