I’m trying to cast to another widget to get a variable (a button variable). As you can see in the first picture, I want to set the visibility of the button to visible when another widget is constructed. Here are some pictures of my set up and errors.
Like the error says, you are trying to read an invalid property. Look at your code, you are setting a visibility to a widget from “S1Ref”. However, S1Ref is not defined until after you set the visibility. So S1Ref will always be null when you run Set Visibility. You need to first define what S1Ref is and then set it’s visibility.
Well first switch the sequence between 0 1 like jwatte suggested. Then uncheck the “Top Level Only” from get all widgets of class. Now assuming this widget is valid, your code should work.
I did as you said and now I don’t get any errors, but my code still doesn’t work. The button’s visibility is not shown still. Would you like to see my design tabs of both widgets (S1Ref widget and the widget of which I’m executing the code)?
Well maybe you have more than one instance of this widget? Best thing to do is save a reference of that widget instead of using get all widgets of class. Anyway, if you want show us your code maybe we can figure out what’s wrong
Basically, I am adding widgets to the scroll box. One of these child widgets is from the “S1Ref”. The actual name of the widget is “Starter1”. That is where the button that we have been trying to make visible, is. Let me show you that widget.
As you can see, the “Here” button is what I am trying to change the visibility. By default, this button is set to Hidden. So now you know all of this, can you think of a way to solve my issue? Is there a better way of going about this?