2021-04-07 02:40 AM
Hi,
I have some flexbuttons in a container.
I'd like to change let's say the border size of all flexbuttons inside that container when one flexbutton is pressed.
Is there a way to do it with some kind of foreach loop ? like: for each item in the container, if the item is a flexbutton, item.changeBorderSize(10);
thanks!
Solved! Go to Solution.
2021-04-07 06:47 AM
I remember looking into this a while ago but I gave up and just created an array of pointers to each widget I wanted to iterate through, with the reasoning that I know my objects at compile-time anyway. These container methods may be useful to you if you still want to try and iterate through the container. Would be interested to know if anyone has accomplished what you described.
2021-04-07 06:47 AM
I remember looking into this a while ago but I gave up and just created an array of pointers to each widget I wanted to iterate through, with the reasoning that I know my objects at compile-time anyway. These container methods may be useful to you if you still want to try and iterate through the container. Would be interested to know if anyone has accomplished what you described.
2021-04-07 11:14 PM
thanks for the workaround!
2023-03-01 05:06 AM
Hi,
Step 1
class DoThisToEveryChild : public GenericCallback< Drawable & >
{
virtual void execute ( Drawable & d ) final
{
// user code here e.g.
// d.setVisible ( false );
}
virtual bool isValid () const final
{
return true;
}
};
Step 2
DoThisToEveryChild doThis {};
// now 'DoThisToEveryChild::execute ()' will be called for every child in 'ticks' container
ticks.forEachChild ( & doThis );