changed() triggers repaint() ?
-
Since when
this.changed()
automatically triggers arepaint()
? Thought it was only triggering the object's callback so I systematically call a repaint in the CB...
Please don't tell me always! -
@ustk I thought the same as you
-
@d-healey I have very complex UI panels and all the paint computation was actually made twice (even four times because of the interaction between them). So I investigated today and found this. As long as you're calling
changed()
in the mouse callback, you never need to repaint... (except some edge cases where you don't need the main CB to be called) -
Check this out:
No repaint method, and I even removed the slave panel CB!HiseSnippet 1207.3oc4W0sSabDEdVfIEusVsQp89Qb05VvrlljVonpXvXZsJ1rkkPRUUUXX2w1iX8LV6N1D2HdZ508cnOB4t9Pza5aP6Y1+MXPDKwUcERl47624mYOm0IT5whhjgHiJmLaLCY7IX2YB0vVCobApy9Hiu.2kFoXga4FPmxHioBVPDZuYioQQLejgwpeuVTiJqghe9mWrGMfJ7XEjPnSkbO1g7QbUAUml+HOH3.pO6D9nRR+jlc7jhVx.4D.VqhsQiodWPGv5Q0hsBFY7n19bkLzUQUrHjwZ6I8m4NTdoHQ9S4Q7yCX5CMPtfgRHefLvWiXMUTqg7.emrvOBAVwoHYrZRx3ywc497b5EIkOKlAoPix4CiUtK30nL7ru+vynD7VKAdOF65ExGqJ3nw1Gi6Hf5UeJTBJCqDYQq7GXbKIHgPUeD8B1AgvgbMrdls8ljmZaW64UMAwhjAr5dALZnklRUSnzDoHSogjQwsENh.x2QxL3.lpkbzXo.NXsQtDan0sPyHcmzcoXl.aj3yplauMo6ttmz9Xhytc5cRUybSWOhobfxh5X4DEWvr5OQ3o3Rg0fZUMeWUyJCzhjzNYk7ST8yY7ALswAt9gzKOl4or9EHxg+TC4QZ77JtuZnUsBB+.nzPkUsecSxNw5pikYPUNTAQRlTmRClvrpQ9xanWh65CM84tKQ66iO0ZeUV5nbBo6QuzsMo0dWKmzUNIh0hFDbNb4oHovlBI3zDCuOI4LTf4dWv7qk3VephV2GZWiCkaFZ53XN0gL3fZZKRfmzez4loZ46ICGQC3+FyGrzVMf7RIsdMYKRwoetFYaxN11OujMDrKyfQWpZX8PpX.yZQ37qtt+hqlMzvkj9DqVTVfjY5ZY9Kls2PsG7SByqtkjtNcyEAP+FIK0Rjh7BftqNTFX4k0RuYB1zI93LTVCdAXllijbdkQxUIWGu6KYIM5wtNuxeSTMW73d3tm1l3z6vplkwz+6tQUpJ1SpXGIrpY9NyJlWYRtNq98WHuzra.Kbgr0y3BuKEsDSFcNKLqSISP3k8yOMAe6SSJOryKoYojfRQGAWczXl31lwfR6vzSaRQEHpJdVS0rYM54+HtudNSdmEJFy5Q3l+0uO9u+o2+BzK6rOb8LyRfQAGMlEp35XvXe1TXgfjoXUv6yhtPIGCgZdeMxX86ieea9ZC+oeyY4GZxZdottWP3jlCiq6ETNqIbEQdY1EE.UeJd2f.RAgH39PGgSHC51ALuBpD5dzsgNSb18nRf68S9fAWYmgm2YGROO0Yqii++Fkb0YzRt5ryZpXuUmLSWhC8gX1cJYVhZQl8ivwKEB6xcicSfMjj9SBnp4WaRuqXJCn6et8Sz6fHh3pYk2k7AYWp6KbeL1gq7FtX7txBvKzt+Pi2zMSqha2uO7NuBvtF9fW+vuFJJYnv.XVbHGZOv8lLxEF.3w.jHh+z.CLbUQqZ7Ya8YclwkI7iO7uvSJyF5yFoLajwDMh5EJeiWxafz69tdLE.Sh3OAnBzMCmIMxduCFaW2FMBVI+Mdd5TwV.1WrN6rD570KgNOYIz4oKgNOaIz4aVBc916TG8WCs6DkbTx0DffS632+aXzVPgtr3NRz+AM9pBf.
-
Very nice! But you have two paint routines that are identical, why not just use one?
-
@d-healey Was just for the sake of the example... In my actual project, widgets are totally different...
-
I just got caught out by a related phenomenon
MIDI automation can trigger the callback of a knob but it won't trigger a panel repaint within the knob's callback. However using
.changed()
instead of repaint will.Here's an example. Moving the knob with the mouse will repaint the panel, but if you use MIDI learn to assign a CC to the knob, moving the CC will change the knob value but it doesn't repaint the panel, swap out repaint for changed and it works fine.
HiseSnippet 1090.3ocsV0saaaCElxIJq1adXcnO.B4JYrNC6s1tgELDm3jzYzkTi4zhcWA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