Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Assign an SButton and call SetEnabled later


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:

 TSharedRef<SButton> testButton;
 void InitialisePluginButtonClicked();

In the constructor of the plugin (.cpp file) I have

 testButton = SNew(SButton)
     .Text(FText::FromString("New Volume Manager"))

and then later in the .cpp the function defined:

     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 ==========
Product Version: UE 4.10
more ▼

asked May 03 '16 at 07:32 PM in C++ Programming

avatar image

57 13 18 25

avatar image Jayae Jul 27 '16 at 06:07 PM

This also happens if I use SAssignNew(testButton ,SButton) and then the button attributes as per https://wiki.unrealengine.com/Slate,_How_to_Make_Fancy_Custom_SButtons.

Does anyone know how to resolve this? I began with the editor plugin wizard which has the UI code in the constructor of the EdModeToolkit class...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Needed to be

      TSharedPtr<SButton> testButton;

more ▼

answered Jul 27 '16 at 06:26 PM

avatar image

57 13 18 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question