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"

Working with slate

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();
 }
Product Version: UE 4.16
Tags:
more ▼

asked Aug 18 '17 at 11:17 AM in C++ Programming

avatar image

Suhaib Rehman
110 5 7 15

avatar image wlosokjan Aug 31 '17 at 04:50 PM

Your code seems ok to me. Is it giving you an error or is it just not working? I would recommend at least UE_LOG inside the ButtonClicked_custom. If it's giving you an error, could you post the whole error? Also, you can try OnClick_Static with a static function.

avatar image darkgaze Jan 11 '18 at 06:57 PM

This is very confusing for developers. In general, Unreal is confusing and having to read code from the engine to understand stuff is really bad.

OnClicked is the only function documented on SButton or similar. Where is that OnClicked_Raw? It doesn't exist in the documentation. I'm trying to fix a bug here and I don't know where this method comes from

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

0 answers: sort voted first
Be the first one to answer this question
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