Download

Adding child to scrollbox not working

Here is my BP:
Bez tytułu.png
It’s returning an error:

The description of the “Top Level Only” boolean on the “get all widgets of class” node reads: “Only the widgets that are direct children of the viewport will be returned.”
So if it is not added to the viewport then it’s not “getting” it. Uncheck it and it should work.

Ok, now it’s not returning error. But I can’t see widget “jakisitem” on screen.

Can you see the parent, ekwipunek?

Yes, it’s adding to viewport after pressing E and I should see jakisitem on ekwipunek.

Hi chydzim,

Please put Wrapbox inside the scrollbox. and try adding child in the wrapbox. It will solve your problem.

c59c766d5a0d12f2d5b0f1d5f192fcd133a58257.jpeg

60aee8c911ddfaabd6762934aed43047a98c001b.jpeg

Nope, still not working :frowning:

@r e f r e s h

The issue could be a million things, you need to provide more information if anyone’s going to be able and willing to help resolve it.

Some questions:
Where is “this is my BP” happening? Inside a widget or another type of blueprint?
If you were to add “…item” widget to the viewport directly, without adding it to the parent, is it visible then?
What does the design tabs of the widgets look like.

Where is “this is my BP” happening? Inside a widget or another type of blueprint? - Sorry, but my english is not really good and I don’t understand the question.
If you were to add “…item” widget to the viewport directly, without adding it to the parent, is it visible then? - Yes, it’s visible.
What does the design tabs of the widgets look like. - Some screenshots:
724323e7dcee263506f4aa6ffcb15070e96b20cb.png
Bez tytułu.png
If we’ll fix problem with invisible widget, I will delete all these buttons and add them in game by blueprints :slight_smile:

In the jakisitem widget, in the hierarchy, delete canvas panel by right clicking - replace - replace with child. The button widget will stretch out and cover the whole screen which seems weird, but that’s how it’s done when adding one widget to another. Well, as far as I know but I’m no widget expert.
Also, the horizontal box seems redundant.

It changes nothing :confused: and in future, I want to set a picture next to button, that’s why I placed horizontal box there.

If we go back to what you had in the picture, with the canvas panel. If you drag the horizontal box (with the button) to the top left part of the dotted line (the canvas panel). Is it visible now?

No, it isn’t.

I should have asked this before but, if you add a button directly to the scroll box in the main widget, does that show up?
Also, are Opcje_Opcj and ekwipunek canvas panels? It looks like the icon for the canvas panel. I’m unsure about how that works. Could you collapse the hierarchy some and take a new screenshot of that?

Yes, if I add child to inventory (ekwipunek = inventory, opcje = settings) after creating widget, it works.
Yes, Opcje_Opcj and ekwipunek are canvas panels.
Bez tytułu.png

This setup with multiple canvas panels really confuses me. I think the intended use is to have the main canvas panel representing the monitor view and then to use other widgets as children. An alternative to the secondary canvas panels is the border widget.
There are many factors that could play into the issue. Is it a blueprint node setup that’s not working or is it the canvas panels, it’s difficult to say.
Using canvas panels like this could be the cause, but then again you say that manually adding buttons are visible, so it seems to be working…

If you decide to replace them with borders, that can easily be done by right clicking the canvas widget - wrap with - border and then again right clicking the canvas panel - replace with - child.

About the blueprint setup, you create the main widget by pressing E? And then what, how are the children added to it? When does the setup you posted in the first thread come into play?

Using canvas panels like this could be the cause, but then again you say that manually adding buttons are visible, so it seems to be working… - I’ve just done this:
2dca54bbb32689fb4f7c58848e299e744e7ea0bc.png
It’s working. That’s not what I wanted (topic is still actual), but it’s working. But only one time - if I open inventory, I can see it. But if I close it and open again, it disappears.

If I am to assume that that blueprint setup happens every time you press E, then it makes sense. Is that the case?

If so, then every time you press E, you create the inventory widget and add one jakisitem to it. Then, when you press it again, you create a whole new widget. What you need to do is create one main widget, I suggest on begin play, and save it as a reference. Then whenever you want to add jakisitem to it, you get the reference.
Am I understanding your setup correct?

– Edit:
Actually, the first one you create, the first time you press E, gets a child added to it.
The second time you press E, you create a whole new inventory widget, and add a child to the first one. The solution is same as above - save a reference.

here’s an example:
invexample.png

  1. On begin play, the widget is created. We save a reference to it.
  2. the R is just an example. every time you want to add a slot to the inventory (or whatever it is you’re doing), you grab the reference and add a child to it.
  3. Now, every time you want to hide or show the widget, you get the reference and add it to viewport or remove from parent, without creating a new widget every time.

Ok, I understand everything. But I can’t get scrollbox from inventory reference. It gives error:

@edit

Man, it works. Thank you so much, I really appreciate it! :slight_smile: