get 2 different callbacks for same object?



  • Is it possible to set 2 callbacks for the same object?
    like this:

    const var ParameterObjects = [Content.getComponent("Knb1"),
                                  Content.getComponent("Knb2"),
                                  Content.getComponent("Btn1"),
                                  Content.getComponent("Btn2")];
    
    //  Button 1    --------------------------------------------------
    inline function onBtn1Control(component, value)
    {
    	Btn1Value.set("bgColour", value == 1? 0xFFFF7700: 0xFF7700FF);
    };
    
    Content.getComponent("Btn1").setControlCallback(onBtn1Control);
    
    // Array Callback
    inline function onParameterObjectsControl(component, value)
    {
        // code
    }
    for(p in ParameterObjects)
    {
        p.setControlCallback(onParameterObjectsControl);
    }
    

    I can't get it to work, they seem to interfere with each other.



  • @ulrik nope, you cant do that - can do the opposite (a single call back for many objects) but not multiple callbacks for one object.



  • @Lindon thank you, then I will not continue trying 🙂



  • @ulrik what are you trying to achieve?



  • @Lindon if you take a look at this, I try to make an A & B Comparison.

    I want to get a callback from the array "ParameterObjects" that will enable/disable the "ComparePnl"

    if SnapShot is clicked the ComparePnl will be disabled until any parameter is changed in "ParameterObjects", that was my purpose, maybe it's overdoing things (like I usually do 🙂 ), but I thought it would be nice to have a visual change to make it clear for the user when it's possible to compare the 2 settings

    HiseSnippet 1840.3ocuYs0bSaDEVNDQIN3VXl9PebwOvXO.NJpboSbBIw4RmLPHt3Tl1gAnxRqsWPdkQZMgzLYF9o0G3Q9IzG5S8Y9GPOqVcYkjksiSnhYHV6tm87c9NW1KpoqiI1yywUovBGd7.rRgqp15XJq2V8LHTk81VovOntkS+AFtXzlHCpEpAZfK1CyTZb7.COOrkRgBW5m4itvByq3+740aXXaPMwwMon7LGhI9wj9DVbqM23QDa6cMrvGR5KM56twdlNzsbrcFBH6RpZJCLLeiQW7SL3CaNUkBWdGKBywsEyfg8TJLeCGqia0y4HpX7Oi3QZai4urrRKXhDMuqisEGw7VU1pGw1pYHC3o.yRyX93RB936U2mXQhZOlWtleGnXIj4iByMN3srL7zld3UPBdyKf20UaY5RFvh6gisEU2ixvtcL.WfLrDiU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hnzc0oyH6KXprwtira9kC3NNAqPG1uM1MrzQ3.gSIm7X3p4eLb4aIvTvMRCzgtGkvNX.ll2gyUBHT3X5WN.UvPY9GR+aCNjdKahE1Ug.mE+xp78dq3iW4KNQYZkUOsrAPXTxJ1fWfr7s.dNjUeJvbovKkvfhs8EcQ0nEplBcmU9qpFG2MhI3W2aaClA+FRB7BfmY.1kQ3N8BaieGwDKtujET2F68Fly..SQw8foMIG06i02K23X4ap5HhEqmbu8vjt8jtjq81PY50jtjl9mAWjZJaPPrl13Oj0zKSqoeOil19rnIYa5Cu8booqjL.4wFsCBPfVh2KWtdKZJ8A1cZ88vM36AjeueY2CnRGH5pE4OkB9zR.uuIO3snZzI3yi1+vuLYxHDbIx8lRsqmV6IbEmYs+We5S+85SkqYQ0nS6laHm0zq84TUBOqHz4k+hxQeInHxTBkwSDmGn.OogxhSSEQov01RPo4fTPAbRofBzBrzryQgKPCk69N0MssQwMPX39YwXbq57l+3G+neyxlSXwUOi2g2i1Tbo+EJLmr4UZpJXGaeHWI66yuMMUeXNTcV7m1pKotkMA9E5.p8wYfrrYs5pqpjjAjm21NtP83mZXQF5IsDyFh1Sl6CYeYuP9qotui0PaCVxuU.+CjDzArykDWJO+h2odD1wxy7WkOfvzB2qq1jvL6MZ7N2HvKrx6Wa7F74XJotSmNvtbiA67p69ae8+1KJhO4Q28MXtDHdV8IC62BhcLw.RnPTOe2kPtAWT+203uyYlVXpk+K7PrfNWl+dgfNWNrSk9FltNuxTraH9G74J9s.Xh5+cuVPce96nn8uoppUSSoOwh7JSSNUbG.6iVF8YPlebFj4tyfL2aFj49yfLOXFj4mFqL7OA3lCYN8EoIPCM2weqnEJrC0.hx7iHU9O.C+r3bC
    


  • @ulrik so basically taking your initial example:

    const var ParameterObjects = [Content.getComponent("Knb1"),
                                  Content.getComponent("Knb2"),
                                  Content.getComponent("Btn1"),
                                  Content.getComponent("Btn2")];
    
    //  Button 1    --------------------------------------------------
    inline function onBtn1Control(component, value)
    {
    
    	Btn1Value.set("bgColour", value == 1? 0xFFFF7700: 0xFF7700FF);
    	for (i=0;i < 4;i++)
    	{
    	    if (ParameterObjects[idx == component)
    	    	ParameterObjectsControl(component, value);
    	}
    };
    
    Content.getComponent("Btn1").setControlCallback(onBtn1Control);
    
    // Array Callback
    function ParameterObjectsControl(component, value)
    {
        // code
    }
    


  • @Lindon thank you, I'll try your example! 🙂



  • @Lindon thank you, it works just the way I would like it to! 🍻

    compare a and b.gif


Log in to reply
 

8
Online

556
Users

2.1k
Topics

16.6k
Posts