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"

AddDynamic must have class/struct/union

Let me say first I Hate Event Callbacks..

Ok so i have some events in my Class HudControl

 public:
     UFUNCTION(BlueprintNativeEvent, Category=MouseEvent)
     void OnMouseClick();

The problem comes why i try to add a C++ coded event into the event. so i have

 UQuestWindow::UQuestWindow(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
 {
     this->SetUp(0, 0, 450, 550, true);
 
     UHudWindowButton* AcceptBtn = NewObject<UHudWindowButton>();
     AcceptBtn->SetUp(this->GetBounds().right - 116, this->GetBounds().bottom - 32, 116, 32, true);
     AcceptBtn->SetText("  Accept");
     AcceptBtn->OnMouseClick.AddDynamic(this, &UQuestWindow::AcceptButtonClick);
 }
 
 void UQuestWindow::AcceptButtonClick(){
     FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(TEXT("Button Clicked")));
     this->Disable();
 }

But all i get is

Error 1 error C2228: left of '.__Internal_AddDynamic' must have class/struct/union {OMITED}\Unreal Projects\Assesment2\Source\Assesment2\QuestWindow.cpp 14 1 Assesment2

How do i bind my event in QuestWindow to the UFunction Event i have created in the HudWindowButton Class?

Product Version: Not Selected
Tags:
more ▼

asked Apr 25 '15 at 05:20 PM in C++ Programming

avatar image

R5kjp9lk
11 1 1 4

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

2 answers: sort voted first

So Apparently The Way i was doing it was not working,

So i set up

 DECLARE_DELEGATE(MouseEvent)

Then Set the OnMouseClick to be

 MouseEvent OnMouseClick

To Bind a C++ Coded Event to it you can't use AddDynamic it only works like

 AcceptBtn->OnMouseClick.BindUObject(this, &UQuestWindow::AcceptButtonClick);

And when using it you use

 OnMouseClick.ExecuteIfBound();
more ▼

answered Apr 27 '15 at 09:25 PM

avatar image

R5kjp9lk
11 1 1 4

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

Thanks! That's what I was looking for.

more ▼

answered Aug 13 '19 at 11:59 PM

avatar image

0xValkyrie
1 1

(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