I Basically want to change the state of a component, for that, I was doing something like this
void desenharpilha2(TImage *b1, TImage *b2, TImage *b3,TImage *b4, TImage *b5)
{
b1->Visible = False;
b2->Visible = False;
b3->Visible = False;
b4->Visible = False;
b5->Visible = False;
}
Basically, passing all the components that I need to change to the function, but I'm sure that there's a better way of doing that.
In short, I need a way to make the function have acess to all the components of the FMX without having to pass all the objects that I'm gonna change, because if I need to change for example, 15 objects, the code will be a mess.
Make desenharpilha2()
be a member of the FMX Form class that owns the controls you are interested in, eg:
class TMyForm : public TForm
{
__published:
TImage *b1;
TImage *b2;
TImage *b3;
TImage *b4;
TImage *b5;
...
public:
...
void desenharpilha2();
};
...
void TMyForm::desenharpilha2()
{
b1->Visible = False;
b2->Visible = False;
b3->Visible = False;
b4->Visible = False;
b5->Visible = False;
}
And then you can call desenharpilha2()
on the desired Form object at runtime when needed, eg:
TMyForm *someForm = ...;
...
someForm->desenharpilha2();