A Button With 5 States!



  • Hey Musc Lovers, Trying To Make A Buttons, With 5 Comands Attached To It!
    So If I Press The Button For The First Time It DoA,
    Second Time, It Do B,
    Third Time It Do C... And D And E!

    Any Snippet Would BE Much Appreciated
    Thanks



  • @Natanr Use a panel + mouse callback



  • @d-healey

    Thank You Sir David
    I'm Trying To Load / And Change Images With The Above Idea!

    What I Tried So Far Is Failed 😞



  • @Natanr what did you try?



  • @d-healey Thank You Sir
    I Just Found This, What A Script ")

    Thank You ❤

    @d-healey said in Single button that switches between multiple panels ?:

    HiseSnippet 1045.3ocsVs0aaaCElx1JH1atXEX+.Hxv.rQtTqzjtAj0VOamrYrkTi4thATTTvHQaSDIRAJpzXTDf8Gd.6o8p2gTRVxopIwCY5E6y8O9Qd3gijBWZTjPhrp+54gTj0WZOdNWMq+LBiiFN.Y8H6SIQJpDmnp27PRTD0CYYU8mzJrpWCY996W1i3S3tzbUHzaDLW5uxBXpbsi59KLe+SHdzWyBJ38AcG5J38E9hX.OUs6fBItWPlROincqhMxZii8XJgbrhnnQfO8DdyGOS7Adh+ugEwN2mpEbPigDknF0eFy2aT1ZMBgrpMJekWMYk+01mx7XK0my.ekw.NOhhbfUkUgTsUfjymCRmH78zI3y.OqBvqVB7dr8XWIKTkaQisuvdHG1blP.ZuHrR7EUAU0tu.7fq1KfbA8DIHrLhVOqSmcvG1oS6iZ1nYCf7iT3KIRbHgS8ivOG+12YrLQHwsXfryQXF9GvGB+r81swerYCL7k39aY657Nvmr5Mkp5KBBEbPn0Viz9r01LcotQL6EAzkNJovu0DheDs8QMtNwMc00HxMVJg7XxBTiccL3hw8YbJdRL2UwDbrf2KVoDbmrr4lAfcf0keLscyFoXlMA2xnB+bXYsbojYZk58BndsyPbQKkBc7SdxOy7n3PI8RlHNJIv7zeikxpkZaMV91zZsmOkOUMSmwSEWRwJAlSuRgYbO5U4I7NAlRFmfK84xD2MACb70Fdr7srTtbq16Eo0axUehu+4PWYqaR0580B6CmITzWwa0twGaTuw0ehkISJyTZp7oxxrpurPdKg0hGGbNUlsSm5Gz+rZC5F2uFT2DJofiB9PNS8pPZpbdKrSIsvnTNU2LmBPvUkoU9QosxILHhAIotcJchLnu3Unnee3.hhjkH8VrTDRkJld4XM.Nk4RStint8.ZzEJQHxxd4FInNorMytAQe.vT0MsM+2AcUdAYcmmKLn6GXdpYP5rdoEBMixlNSok5.RLEMH6155afPK5Xheo18Kp9xLZ1pJp.z17Nf19ODPaA5EkAsEncLpQqAU8zGDpZw2TJUsXmaiptKncvCCz9qxg1+baPy9dbtt.35U.b+IsKK5TQ.jGhDTaUA8oy9fIvBuXehZ0wx52ejZ.tIXk4e5Yb7HlZdw2mrFyp6T5r5Razumv8w1iXJ2Yki2JkfWng++a7l9xml1GOYB0UkC1Z1m7G+WelyZ.keSDqX7omRTRFb9v9r3fwvQNWJfDtdnl9PZEcGZhbGsrlYFS4dFgEvWpQGsrUpQmLin.hqT7d2jqf0usZSiF.SbyyJqCuuEjwKu4Ui6.3Aeu20USD6BHu7H1esi3oqcDGr1Qb3ZGwyV6H9t0Nhu+VhP+55eLVIBRZK.EiN1Lwyx5XNANUYNAh9WUW5WCA



  • @d-healey

    Is This Possible To Keep The Last Visible Panel That Selected Visible?!
    Once I Hit Copile, All Panels Hides, And It Goes Back To The First One!!!

    Content.makeFrontInterface(600, 500);
    
    
    const var panels = [];
    
    for (i = 1; i < 5; i++) {
        panels[i-1] = Content.getComponent("Panel"+i);
        panels[i-1].showControl(false);
    }   
    var currentPanel = -1;
    
    inline function onButton1Control(component, value)
    {
        if (value == 1) {
            if (currentPanel > -1) panels[currentPanel].showControl(false); //Hide previous panel
            currentPanel = (currentPanel + 1) % panels.length; //Move to next index
            panels[currentPanel].showControl(true); //Show panel
        }
    };
    
    Content.getComponent("Button1").setControlCallback(onButton1Control);
    


  • Isn't this different to what you wanted? I thought you want a button with 5 states.


Log in to reply
 

7
Online

881
Users

3.1k
Topics

26.6k
Posts