x

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"

Cannot add ComboButton to Toolbar - why?

Using the Settings dropdown as a guide, I'm trying to add a combo (dropdown) button to the main toolbar:

 void FGameDataEditorModule::AddToolbarExtension(FToolBarBuilder& Builder)
 {
     Builder.BeginSection("Editors");
     {
         Builder.AddComboButton(
             FUIAction(),
             FOnGetContent::CreateStatic(&FGameDataEditorModule::GenerateGameDataMenu, PluginCommands)
         );
     }
     Builder.EndSection();
 }
 
 TSharedRef<SWidget> FGameDataEditorModule::GenerateGameDataMenu(TSharedRef<FUICommandList> InCommandList)
 {
     FMenuBuilder MenuBuilder(true, InCommandList);
 
     MenuBuilder.BeginSection("Data Editors");
     {
         MenuBuilder.AddMenuEntry(FGameDataEditorCommands::Get().OpenPluginWindow);
     }
     MenuBuilder.EndSection();
 
     return MenuBuilder.MakeWidget();
 }


This gives the following compile error:

 1>D:\UE4 Projects\PROJECT\Plugins\GameDataEditor\Source\GameDataEditor\Private\GameDataEditor.cpp(126): error C2664: 'TBaseDelegate<TSharedRef<SWidget,0>> TBaseDelegate<TSharedRef<SWidget,0>>::CreateStatic<TSharedPtr<ObjectType,0>>(TSharedRef<SWidget,0> (__cdecl *)(TSharedPtr<ObjectType,0>),TSharedPtr<ObjectType,0>)': cannot convert argument 1 from 'TSharedRef<SWidget,0> (__cdecl FGameDataEditorModule::* )(TSharedRef<ObjectType,0>)' to 'TSharedRef<SWidget,0> (__cdecl *)(TSharedPtr<ObjectType,0>)'
 1>          with
 1>          [
 1>              ObjectType=FUICommandList
 1>          ]
 1>  D:\UE4 Projects\PROJECT\Plugins\GameDataEditor\Source\GameDataEditor\Private\GameDataEditor.cpp(126): note: There is no context in which this conversion is possible
 1>D:\UE4 Projects\PROJECT\Plugins\GameDataEditor\Source\GameDataEditor\Private\GameDataEditor.cpp(127): error C2660: 'FToolBarBuilder::AddComboButton': function does not take 1 arguments


I have no idea why the FOnGetContent entry isn't being recognized. Can anyone help?

Product Version: UE 4.14
Tags:
more ▼

asked Mar 09 '17 at 09:24 PM in C++ Programming

avatar image

Rehven
31 4 7 10

avatar image Yasser_213 Jan 10 '19 at 02:27 PM

Hi, make sure that the declaration of GenerateGameDataMenu is static static TSharedRef GenerateGameDataMenu (TSharedRef InCommandList);

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Your function's parameter type is "TSharedRef" in GenerateGameDataMenu,But in CreateStatic,Your parameter type is "TSharedPtr".

more ▼

answered Feb 26 '19 at 07:25 AM

avatar image

xingcheng
1

(comments are locked)
10|2000 characters needed characters left

But it's still wrong ,I'm confused.Did you know the answer?

more ▼

answered Feb 26 '19 at 07:32 AM

avatar image

xingcheng
1

(comments are locked)
10|2000 characters needed characters left
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