Hello dev, Hope you’re all well. I just started out experimenting with creating plugins and slate. I guess I got the basic understanding of it. But well right now I am having a small problem. For the plugin creating a button, and its giving error of AsShared is not a member. I checked for solution online which said to use “OnClicked_Raw” is of “On Clicked” or call “CreateRaw” inside “OnClicked()”. Ive tried both and none of these works. Ill share the code here. I need solution for this. Hope to get help -fingers crossed-
//Cpp file
TSharedRef<SDockTab> FImageComparator_ESWModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
{
FText WidgetText = FText::Format(
LOCTEXT("WindowWidgetText", "Add code to {0} in {1} to override this window's contents"),
FText::FromString(TEXT("FImageComparator_ESWModule::OnSpawnPluginTab")),
FText::FromString(TEXT("ImageComparator_ESW.cpp"))
);
FString PathToImage;
PathToImage = TEXT("default_pictures/HighresScreenshot00000.png");
FString ImagePath = FPaths::GameContentDir() / PathToImage;
FName BrushName = FName(*ImagePath);
return SNew(SDockTab)
.TabRole(ETabRole::NomadTab)
[
// Put your tab content here!
SNew(SBorder)
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
[
SNew(SHorizontalBox)
+SHorizontalBox::Slot() .HAlign(HAlign_Fill) .VAlign(VAlign_Fill)
[
SNew(SImage)
.Image(new FSlateImageBrush(BrushName, FVector2D(1920, 1080)))
]
+SHorizontalBox::Slot() .HAlign(HAlign_Right) .VAlign(VAlign_Bottom)
[
SNew(SVerticalBox)
+SVerticalBox::Slot() .HAlign(HAlign_Fill) .VAlign(VAlign_Fill)
[
SNew(SButton)
.ButtonStyle(FEditorStyle::Get(), "FlatButton")
.ForegroundColor(FLinearColor::White)
.Text(LOCTEXT("PaperExtractSpritesCancelButton", "Cancel"))
.OnClicked_Raw(this, &FImageComparator_ESWModule::ButtonClicked_custom)
]
]
]
];
}
FReply FImageComparator_ESWModule::ButtonClicked_custom()
{
return FReply::Handled();
}