Hi
I’m writing a plugin starting from the Editor Mode wizard example. I’ve got an SButton set up to be disabled by default, and I want to enable it from a member function of the plugin which will be called later.
The UI works fine in terms of layout until I try to do the assignment to testButton below. Is this not the way to accomplish what I want? Obviously if I don’t do the assignment then my SetEnabled would fail
I tried making the type TSharedRef* to be a pointer, but that gave the error that it can’t convert between the return type from SNew to a pointer.
In the plugin .h file:
private:
TSharedRef<SButton> testButton;
void InitialisePluginButtonClicked();
In the constructor of the plugin (.cpp file) I have
//UI CODE^
testButton = SNew(SButton)
.Text(FText::FromString("New Volume Manager"))
.IsEnabled(false)
//UI CODE
and then later in the .cpp the function defined:
FVASFVPluginEdModeToolkit::InitialisePluginButtonClicked()
{
testButton->SetEnabled(true);
return FReply::Handled();
}
But, on compiling though I get the errors, which I don’t understand.
1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: VASFVPluginProject, Configuration: Development_Editor x64 ------
2> Performing 2 actions (4 in parallel)
2> VASFVPluginEdModeToolkit.cpp
2>H:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h(176): error C2248: 'FSlateControlledConstruction::operator new': cannot access private member declared in class 'FSlateControlledConstruction'
2> H:\Program Files\Epic Games\4.10\Engine\Source\Runtime\SlateCore\Public\Widgets\SWidget.h(54): note: see declaration of 'FSlateControlledConstruction::operator new'
2> H:\Program Files\Epic Games\4.10\Engine\Source\Runtime\SlateCore\Public\Widgets\SWidget.h(41): note: see declaration of 'FSlateControlledConstruction'
2> H:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h(176): note: while compiling class template member function 'TSharedRef<ObjectType,0>::TSharedRef(void)'
2> with
2> [
2> ObjectType=SButton
2> ]
2> H:\Users\Jonathan\Documents\Unreal Projects\VASFVPluginProject\Plugins\VASFVPlugin\Source\VASFVPlugin\Private\VASFVPluginEdModeToolkit.cpp(12): note: see reference to function template instantiation 'TSharedRef<ObjectType,0>::TSharedRef(void)' being compiled
2> with
2> [
2> ObjectType=SButton
2> ]
2> H:\Users\Jonathan\Documents\Unreal Projects\VASFVPluginProject\Plugins\VASFVPlugin\Source\VASFVPlugin\Public\VASFVPluginEdModeToolkit.h(52): note: see reference to class template instantiation 'TSharedRef<ObjectType,0>' being compiled
2> with
2> [
2> ObjectType=SButton
2> ]
2> -------- End Detailed Actions Stats -----------------------------------------------------------
2>ERROR : UBT error : Failed to produce item: H:\Users\Jonathan\Documents\Unreal Projects\VASFVPluginProject\Plugins\VASFVPlugin\Binaries\Win64\UE4Editor-VASFVPlugin.pdb
2> Total build time: 4.57 seconds
2>H:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command ""H:\Program Files\Epic Games\4.10\Engine\Build\BatchFiles\Build.bat" VASFVPluginProjectEditor Win64 Development "H:\Users\Jonathan\Documents\Unreal Projects\VASFVPluginProject\VASFVPluginProject.uproject" -rocket -waitmutex" exited with code -1.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========