Calling events between widgets not working (once again)

I want to call an event made in widget 2, inside widget 1. All the event does is change the visibility of an image to hidden:

I tried ‘Get all widgets of class’ then calling the event, didn’t work (no clue why):

then tried ‘Create widget of class’, didn’t work either, probably cus there’s multiple instances of the widget. It executes the code just fine but doesn’t show any changes made when running game:

output log:
log

i’ve been trying to figure it out for days, if you’d like to see any other supporting code feel free to ask.

Thank you for any replies

Because you ticked Top Level Only. But even if that worked, it would not work in the long run…

tried ‘Create widget of class’, didn’t work either, probably cus there’s multiple instances of the widget.

tl;dr: you’re trying to do something that makes little sense in the context of working with panel views.

Perhaps it would be best to take a step back and study how the ListView works a bit closer first. Because that’s what we’re dealing with here, right? Generally speaking:

  • you would not modify the widget itself
  • instead, you would modify the data in the underlying object and regenerate list entries (either all because we’re lazy, it’s convenient and there’s just a handful being kept alive; or regenerate one entry only - a bit more upfront work is needed here)

Identify which widget is supposed to be affected. Once this is known, modify the data in the object that was used to feed the widget data, then refresh the list view; if you do not do this, the change will be temporary only and the list will regenerate entries using stale data

Hi @str4w_b3rrieZ . for what you are doing, I don’t see why you would run “GetAllWidgetsOfClass” as that would return to you every widget of that class create and it may not be the one you want in case there are multiple. Assuming that I understand your code correctly, following might help with your problem.

  1. Set the widget 2 to variable in widget 1. This is assuming you have added Widget 2 in 1 using Designer.
    image

  2. Now you have access to the inside widget here and this also gives you access to event and function inside of widget 2. Following images show case that.
    Widget2:

Widget1:

GIF:
35545894e3a32a8e6a9c717924831acd

If there are any questions feel free to ask. The answer before mine does explain more as well.

Hello, thank you so much for your reply, I apologize on my lack of knowledge with widgets, I’m a beginner and still learning. The solutions I provided were based on answers I received from previous users :slight_smile:

Would you be able to explain this further? I think I’m approaching my problem in the wrong way. I’ll explain my problem better for you:

in the image below I have a bubble that appears behind my image that I added to my list view:
Capture

I don’t want that to be there.

The reason why this is happening is because my list view contains both the ‘bubble’ & image.

Capture2

So when data is passed, from my data structure (as you mentioned), both appear, even when I am only setting data for the image only.

The data structure that passes data to the list view entry:

The issue I noticed is that because the default value of ‘bubble’ has been set it will always appear behind the image. I thought an easy fix would be to just not put a default value, but if i do that, when i add images to my list view, nothing appears.

So this is the issue i’m trying to fix. I thought hiding it would help (probably not now)

So as you said editing the data being passed is a better idea, so how would i go about doing that here?

  • this is the Object that holds my data:

image

  • the List View widget creates some objects and feeds them new text :point_down: (this can be done elsewhere, ofc):

The Custom Event :point_up_2: modifies the data inside the object (not the widget!), and then asks the list view to regenerate all existing widget entries (note this is not as bad as it sounds, the widgets are not destroyed and recreated from scratch but refreshed via the Event On List Item Object Set). The custom event would trigger the script below :point_down:

  • this is my Entry Widget that sits inside the List View widget:

When the list view instantiates it (or regenerates it), we pull the data from the ObjListViewData and apply it to the widget. In this example, it would clear the text and hide the text block.


Your job is to fire this event, you must know which entry in the list needs to be modified:

image

2 Likes

Hello, thank you so much, the issue has been resolved thanks to your guidance, I am very grateful to you, have a wonderful day.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.