#define MAX_PANELS 500 // ? as many as you need
PANEL* array_panels_d_elemente[MAX_PANELS];
var totalPanels = 0;
if(totalPanels < MAX_PANELS)
{
array_panels_d_elemente[totalPanels] = pan_create(.....);
totalPanels += 1;
}
if ( mouse_right && mouse_panel != NULL )
{
int i;
for(i=0;i<50;i++)
{
if(mouse_panel == array_panels_d_elemente[i])
{
// panel found do stuff here //
break; // stop the loop
}
}
}