How to designate Button Radio Group via script
-
hey all, exactly as the title says i have a group of buttons ive created with panels alone. how can i make them part of the same radio group via scripting?
-
@Adam_G This is the main principle
const var pnls = [Content.getComponent("Panel1"), Content.getComponent("Panel2"), Content.getComponent("Panel3"), Content.getComponent("Panel4")]; for (p in pnls) { p.set("allowCallbacks", "Clicks Only"); p.data.v = 0; p.setPaintRoutine(function(g) { g.fillAll(Colours.black); g.setColour(Colours.white); g.setFont("Arial Bold", 24.0); g.drawAlignedText(this.data.v, this.getLocalBounds(0.0), "centred"); }); p.setMouseCallback(function(event) { if (event.clicked) { for (panel in pnls) { panel.data.v = panel == this; panel.changed(); } } }); }
HiseSnippet 1013.3ocuV02ihSDFeJP0qnmwKwO.M7WkDj.r3oIW13tvtXHdrKQVunwXtL6zA5jc5L0NSWNhYS7imeb7af9LsEZ4N.2CiWSfzmW9M42ySedYlFKITkRFirbtYUDEY8o1yVIzACCvLAZ7EHqOydBVoowtYpFrJBqTTejkU0uynvxoFJ84u91AXNVPnEpPnWIYD5KYgLcg1om88LNeD1mdCKrj28OaLQJFJ4xDfOUs6fhvj6vKnWgMtUwFY8QW5yzx3YZrlpPV0FH8WMKPtTj4+qXJ1sbpQnKZFbPYpGI49FFazhFFv39SWG2JDbJSKxBUyxBeg8DlOai9hrwmmZvs.Q47gUksoW0snW2xzqSI5sCJYUhR0xnzyrmQhYQ5BKF97I1iEvGm4XHsWlJY9hpLop8PI3gP2NDeGcTLHrAg2y6zokK7WyWTuNj5UZ26wwtQBtx8T2eYMvET8PYXjT.BdMlhETd2FMaU28cdN.hdu2HN48FQ+FM+UHRlKic8hbYhzHoY8eutSTaEE7By4xkCg+uEJrTMZ41XHmAu4dsfupAjE.G8wZb66g3uCHlibJ74W+CxDMSP8lmHHZlT3snYcG3rcVzdNTOeNm6kU6pZeKGNeywA1TFdZTuw5x.llVXcjzD.mGyvb2APkJPqd8a2I2A+X7xy4rEBp+Mz2n8zALUNGa4lJ.IhWJIX9.YhvW40AfBAFARKwT+zf5glEgxDYhhtNETDKz6A+yiG1b2L41DS1g5C5SM3jkYMo5hrqStMmT8EouL2N8zTR9hRdPBvhETeuz.z4g5Y+bxn4C0gm0rxUJtRpoWK7R+HBFceaSymuSalhjXImSi2oYybm3CAzSjDdKMtEzOvSnabDZF2tC2d+c3kG.QxpYK4nTLVvzWGQE6arDJuPGd6GGeAjUMiEx0A9EQi0LCErtfdOLiMaHgi8ET0cZYDvzMcGHqOVmZ8oqGgX9NfXvfhmXm0NidSwXX1YqJD94yVx70APjZ8mfX.ksHPaj5ARa2NYN+RsSl.3QSfd6k.9eXHvI6i.+wceXHP+8Rfe6+.Ad20HvBLoeBGq2dqlYUdtAnQXqUIl0EBESup7p92dUWsG2ptCuI9wR2mYOkoIA6luU1AegVm+u4a9EGdp8kymSI5BxVydzOcvaIT6wMC4egJYamVLAqiYPkj8UIgyfsMDJvDATeYFVYUwLVIStiQ1jYlQE9oB+M7jarqQ1J2X20FQgXRr70jrQjlqo7jTM.mDo2PyAtpHH61EkN1DvYCaiPgvMldMgXREeIv8cio2Qf4ji.S+i.yWcDXd9Qf4qOBLeyAwXtr54IZYXVaBnX5ko6RrrtTfgprzJRz+jqJ3jH
-
@ustk thank you :D
-
@ustk im attempting to make this work with a midi players play/stop but i can only get it to do one or the other. any idea what im doing wrong here?
HiseSnippet 2662.3oc6Yk0aqabEV5ZqjXmlfaJBJ5SspWTfpa8MS0pkTCBh4pD0JEojrjqaMnHGRMRbSbQaAWf92pEsnn+C5y8WQdqOlNjT1hJWGGWijfjhvGn0bV3bV9lyblw7NVxPWWKmDIOo+FaXhj+jThaL8lRMUBYlfiNQx2OUaIWOnS5HRjarkbcgJIRl7nZADRdxwIBe97OkTRWxTFtmThDCsPxvVHCj2dp7WzDoqyJo.6iLhIcwK3jsLorzs7w1yQoxlvVRdtjFriTfXOKUhjuEiBxyxQzSxC5lH4wjVJaDmZsxLR9gHWzDcXvfbIDwenHxrV5JAVb.0DTSQ5J7252tIRjLE+9nvQQQgOLUajB5N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at the first place instead of the data object
But notice that you could have used the data object in the CB too and it would have worked (component.data.v instead of Panel1.event.clicked which does not belong to the CB)here you go
HiseSnippet 2495.3oc6Ys0aiabElxdYRjSSvlhfh9TK6hBTs0aX0MKK0hfXJRcmRhVTRVZqaMnHGJMRjCo3EcKXA5eqVzhh9OnuzW5uh7VeLcFRIKpc8555lDjTDAXYOmyb37cNmu4vyLVxwRE35Z4PEKd201.pX+.Z40HuI7STfHpZBTw9P5lJtd.GlPQEWaq35BznhE63JDAwh+DpfOewmUTwPAoB1KhhpuETEHBMgd6kJcQCngQYEMPWnYjYm8hZpVHdKCKeLdNlNIksh5LkwfVJjocDMUr2ojFzyxQ1SwC3RE6IEszVKOwZIJb98gtvQF.xfTTx3GTn3xVFZDDSjRwOAZnIsyuconhQKsOJbbXT3ioaB0f2Jeez3oAJX1aQz3QriNDdGe.7REEdIi.u6.RGEARu6tDS.jLTVCb1kXpITiITRpC.BuuiC.4ICl6CNHg7wWrUUWGbnMZtSzxxtDRACOsnhIO8Q3oJaCNTQriev9Zp60WoHtUYnAHHUra.d1DeDmyET7TnNpPL5zYRxh5lqQd9T0355wwVsFuylhSsjXEgyFOdLGrxn5Bc5vNIyfFabGr1ddmhSzmvUnVJgIm6zLWstxx8qO7TQkNUr7qr3pdmKbVs9qka1D5tJ0JatRy0qWeFXQWkJ1H8LUDWpULKJGeEM47sxXN5rbn9bhWVd4b1KACSdUxLSDDFmVrStIh08qhbaXrf2uB5k45rVE0VIeOoAU4fBE3FV0Rco3jzh1pKqT2utKPhWKSEmkxmpWeSgh0OUmeSKXgRUyq3joxjpHwwb0WYVQ+zS0gqlxJwxV8RN1xE6KkksS4AxrroYKxOOyF9FV3nQmABndBtZr8W0tZI+UiFUsQutrTjvY3NnOg9yk5ztdI9t2TtsnPoNuhioouiFv4FNFSHxx4lToSWTpIqIjviHaOkgiQJd9NXyemV9lEUv4rczfu3mdQKKrcJdAEP1xMd5EB.zcIlPwvzEGunEHB4cGPs5BLssHB9yZ+qe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