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 Disable UCanvasPanel

I'm trying to disable the CanvasPanel, and all its children. Unfortunately nothing seems to work.

From the Canvas C++ code, SetIsEnabled(false) does not work. Looping through all the widgets doesn't seem to work:

 TArray<UWidget*> widgets;
 for (int32 x = 0; x < widgets.Num(); ++x)

When I uncheck the Is Enabled for the CanvasPanel within the editor, and start my game, it works.

What am I doing wrong? Any suggestions?

Product Version: UE 4.15
more ▼

asked May 19 '17 at 12:19 AM in C++ Programming

avatar image

168 11 17 31

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

1 answer: sort voted first

The Code you got has a slight error you increasse "x" first basicly skipping the first item Change it to "x++" instead and it will work as you have it.

Alternativly you can do this =) it looks nicer

 WidgetTree->ForEachWidget([&](UWidget* Widget) {
more ▼

answered May 19 '17 at 01:22 AM

avatar image

7k 143 28 172

avatar image Jerry.Richards May 19 '17 at 06:47 AM

Thank you Nachtmahr, the ForEachWidget is a nice alternative.

I would like to point out that the above code does not miss the first element, as can be seen from a Visual Studio screenshot:

alt text

Also, I would recommend a Internet search on Pre-Post Increment reasons. For example, here is one:


prepostinc.jpg (41.1 kB)
avatar image Nachtmahr May 19 '17 at 10:47 PM

I tried it with:


Result: https://gyazo.com/a381b57b10b5a963e73533a1d67925b9

Even if I PrintString the IsEnabled state of the Canvas it tels me false. Everything works as expected regardless if I start out with false or true. Did you by any chance grabbed some SubTree?

avatar image Jerry.Richards May 20 '17 at 06:16 PM

Yes, you are right, it does work as expected.

The real problem was incorrectly thinking that I was displaying a model window and waiting for the response:

     menuManager->ShowMenu(DeleteMenu, false);
(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