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"

Can't assign pointer variable in widgets

Hi, I've created a custom UCanvasPanel, which has 4 public variables:

     UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
         UDB_InteractiveCanvasPanel* LeftPanel;
     UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
         UDB_InteractiveCanvasPanel* RightPanel;
     UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
         UDB_InteractiveCanvasPanel* TopPanel;
     UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Category = "Other Panels")
         UDB_InteractiveCanvasPanel* BotPanel;


basicly they are pointers to other canvas panels in current widget. The problem is that I cannot set them up in the details tab - they show up on the list but when I click any canvas panel, nothing happens.

Image:

alt text

For now what I do is I'm setting everything up in the Event Construct, but that is just making mess when there is a lot of panels on the widget. Is there a way to make it work?

Product Version: UE 4.19
Tags:
more ▼

asked Nov 28 '18 at 10:24 AM in C++ Programming

avatar image

King Zero
25 1 4

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

1 answer: sort voted first

There SynchronizeProperties event where you should sync UMG widget properties with Slate widgets that your UMG widget operates

https://api.unrealengine.com/INT/API/Runtime/UMG/Components/UWidget/SynchronizeProperties/index.html

more ▼

answered Nov 28 '18 at 10:48 AM

avatar image

Shadowriver
35.9k 928 169 1105

avatar image King Zero Nov 28 '18 at 11:38 AM

I don't quite understand how to use it to synchronize my variables, and from what I've seen in the Internet, I'm not sure if that function would help.

avatar image King Zero Nov 29 '18 at 08:19 AM

Ok, I managed to finally solve it with your help, thank you so much!

I don't know if it's the best way to do it, but I've created bindings to my variables. For anyone having the same problem here is my code:

.h

 //Property Bindings
 public:
 virtual void SynchronizeProperties() override;

     DECLARE_DYNAMIC_DELEGATE_RetVal(UDB_InteractiveCanvasPanel*, FGetPanel);
     UPROPERTY() FGetPanel TopPanelDelegate;
     UPROPERTY() FGetPanel BotPanelDelegate;
     UPROPERTY() FGetPanel LeftPanelDelegate;
     UPROPERTY() FGetPanel RightPanelDelegate;
 protected:
     PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, TopPanel);
     PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, BotPanel);
     PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, LeftPanel);
     PROPERTY_BINDING_IMPLEMENTATION(UDB_InteractiveCanvasPanel*, RightPanel);


.cpp

 void UDB_InteractiveCanvasPanel::SynchronizeProperties()
 {
     Super::SynchronizeProperties();
     TAttribute<UDB_InteractiveCanvasPanel*> TopPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, TopPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
     TopPanel = TopPanelBinding.Get();
     TAttribute<UDB_InteractiveCanvasPanel*> BotPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, BotPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
     BotPanel = BotPanelBinding.Get();
     TAttribute<UDB_InteractiveCanvasPanel*> LeftPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, LeftPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
     LeftPanel = LeftPanelBinding.Get();
     TAttribute<UDB_InteractiveCanvasPanel*> RightPanelBinding = PROPERTY_BINDING(UDB_InteractiveCanvasPanel*, RightPanel);// OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage);
     RightPanel = RightPanelBinding.Get();
 }
(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