I've made a custom checkbox with two images. One for an empty box and a second one with a checkmark in the box. It works fine but I'm trying to figure out how to do this with 7 buttons. In C# I would probably make some sort of array of buttons so that they can do something like (pseudo C# code)
Button Buttons = new Button[7];
foreach ( Button b in Buttons )
b.Image = "cbempty.png";
void Button1_Click ()
{
ToggleButton(0);
}
void Button2_Click ()
{
ToggleButton(1);
}
void ToggleButton ( int index )
{
Buttons[index].Image = (Buttons[index].Image=="cbempty.png")?"cbchecked.png":"cbempty.png";
return;
}
The above is something like I want to accomplish. I would rather not make a seperat if statement for every single button.
Button Buttons = new Button[7];
foreach ( Button b in Buttons )
b.Image = "cbempty.png";
void Button1_Click ()
{
ToggleButton(0);
}
void Button2_Click ()
{
ToggleButton(1);
}
void ToggleButton ( int index )
{
Buttons[index].Image = (Buttons[index].Image=="cbempty.png")?"cbchecked.png":"cbempty.png";
return;
}
The above is something like I want to accomplish. I would rather not make a seperat if statement for every single button.