Not really, it makes the 'more difficult to explain' version more necessary.
Unless you are storing them in the array to try to make the selection work...
The simple way would have worked
roughly like this.
I dont know if you are aware, but when a button is clicked and calls its function,
it is also passing a couple of parameters to that function.
It is passing its button number within the panel, and a pointer to the panel itself.
So if all the buttons were in one panel, just assign all the buttons to ONE function,
and have that function look at the button number, and call whichever "on_levelX()" is required.
Easy, see?
(if you want, I can elaborate further)But sticking with a multi-panel single-button-per-panel menu, weve gotta go my other way.
When you are building your panels, you need to add a line after the pan create, to modify a value.
arr_levels[column][row] = pan_create("button..., on_level_button, NULL, NULL);", 10);
(arr_levels[column][row]).skill_x = level_ID; //or row+(column*5)
and the function that all the buttons will call is this
function on_level_button(var butt_num, PANEL* pan)
{
var level_ID = pan.skill_x;
if (level_ID==1) on_level1();
else if(level_ID==2) on_level2();
else if(level_ID==3) on_level3();
else if(level_ID==4) on_level4();
else if(level_ID==5) on_level5();
else if(level_ID==6) on_level6();
... etc
}
Get what I mean?