Changing state for several hundred widgets

I need different widgets to switch from “Normal” to “State 1” so that the prototype starts with that state. During runtime, I change the state with an action but how can I switch all these widgets so that their initial state is “State 1”?

while editing or in the prototype? For editing you have to use (multi-)selection and change the state. For the prototype you can use a “Load Screen”-action to change the state (using “All Widgets of the Same Type”-modifier). Does this help?

It’s while editing. I don’t want to use a “Load Screen” action because the prototype will still load with the wrong states active and then switch over. It’s a good solution for small prototypes but the one I am looking at is in the 200 MB ballpark. I want to set these widgets to be in the other state when the prototype loads. Is there a way? If there was a mechanism whereby I could select all widgets of the same type in the tree view that would do it.

Select All Widgets of the Same Type.fscript.zip (761 Bytes)

This plugin should do the trick:

  1. select on widget
  2. execute the script

→ all widgets of the same type are selected on this screen

just tested it in a bigger file: I think I have to optimize it … :snail: . What helps: “hide selection” before executing the plugin, but changing the state for hundreds of widgets is slow …

Yes, it’s slow but it’s a lot faster than doing it manually. It’s actually done what I needed. THANKS!

Actually, selecting the widgets was OK. Changing the state for all of the selected widgets is REALLY slow.

I just noticed that that is what you said, Felix. Sorry, too many things at going on at the same time.

Yup. Some severe bookkeeping going on there…

:flushed: as a quick fix we could change the active state without any GUI/canvas update:

Change state of all this widgets.fscript.zip (899 Bytes)

  • select one widget
  • change this widget to the state
  • execute the script

(does basically the same, as manually, but simply rebuilds the whole screen afterwards which is faster and takes less memory)

1 Like

That worked REALLY fast. And it’s actually much more elegant because it only requires one step. It should be included as a standard. I have needed this so many times…
Thanks again for all your help!

@fizfaz could you think of a way of updating Widgets faster as well? I have just been waiting 12 minutes for my project to update. That’s too long. I’m fighting against a deadline. :hot_face: