Counting Loops with branches in widgets.

Hey there.

I have a loop that creates widgets and I want to count the branch hits inside.

Eg.

  1. My Control Widget starts a “for loop”, creating 10 widgets
  2. My created widgets have a branch inside.
  3. I want to count how many times the branch is yes or no
  4. send that information back to the control widget.

I tried using delegates but I don’t want to bind them inside the created widget as I’td bind several times assumably. Equally, Delegates I feel don’t really go that way around.

I tried counting after the branch with incremental or ints, but It resets the counter on every creation, so renders it useless. I think this is the way still, but I just can’t work it out.

I tried creating a custom event that’d trigger every time the branch was hit inside control with the trigger being at the end of the created branch, but it comes up with accessed none.

I’m bit stumped, but it feels really easy, and I just can’t seem to kick my brain into the correct direction.

If anyone could put me out of my misery, I’d be appreciated.

Thanks

So what I ended up doing is putting an “set int” In front of the branches in the created widgets.

When it hits yes it sets 1
when it hits no it sets 0

I created a custom loop In the control widget and added the trigger just after the loop.

So when it loops and branches. It triggers the count every single time and just takes the sets and add it to a local counter in control.

Done. It adds up the total and hits another branch in control for the desired effect.

It feels really clumsy… But it technically works. So ill take it lol.

If anyone has a better way. Itd be cool to know how.

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