group conditional for all buttons clicked?

susanmacnab
susanmacnab Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 52 ☆ Superstar ☆

This may seem pretty basic but is there a conditional that will trigger once all buttons in a button group have been clicked on?

I tried just checking each button's state but the most recent click appears as "selected" so we never really have all buttons in "visited" state.

I keep reverting back to the old technique of tracking my clicks in a variable because I can't get it to work any other way.

Answers

  • beeps
    beeps Community Member Posts: 40 ✶ Headliner ✶

    You can do this with variables.

    Create a variable (for example, MyVar) and put an action on each button that adds to the variable. Then include an action will run the action you want triggered after the variable conditions have been met. For example:

    Button 1

    • On mouseclick >modify MyVar >add to variable a
    • On mouseclick >DO TRIGGER ACTION *if* MyVar contains A, MyVar contains B

    Button 2

    • On mouseclick >modify MyVar >add to variable b
    • On mouseclick >DO TRIGGER ACTION if MyVar contains A, MyVar contains B

    You can keep adding to the variable until every button you want users to click has been clicked. I hope this helps ☺️

  • susanmacnab
    susanmacnab Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 52 ☆ Superstar ☆
    edited February 1, 2023

    Thank you @beeps for your suggestion.

    I am aware of the variable method and have been using it for years.

    When Lectora 21 came out with improved button states and grouping, I assumed that there would be a built-in feature that could trigger an action once all buttons in a group have been clicked on. Unfortunately it doesn't seem to exist.

    The variable method works perfectly, of course, but it's something that all new users have to learn on their own. If there was a conditional for "all buttons in group x have been clicked on" or even if each button had a "visited or selected" conditional it could cut out a few steps for us developers.

  • timk
    timk Community Member Posts: 1,244 ✭ Legend ✭

    They should add some "negative Relationships" e.g. If Button 1 is "not normal".

  • CarlJFink
    CarlJFink Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 163 ♦ Idol ♦

    You could say that in the Feature Requests area, of course.

  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 702 eLearning ROCKSTAR Admin Team

    This is a little cheesy, but if you add an action to each button to set it to visited before you do the conditional check, then afterward set it selected it might work the way you want.

    <each button>

    <action> On Mouse Click -> Set State -> This Object -> Visited

    <action> (do your conditional check here for visited states)

    <action> On Mouse Click -> Set State -> This Object -> Selected



  • susanmacnab
    susanmacnab Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 52 ☆ Superstar ☆

    Thanks @wheels I never thought of that workaround. I'll keep it in mind next time instead of keeping a variable.