Assign names to widgets dynamically

Dear all,

    I am working on GUI which requires buttons ,labels and indicators, each 48 numbers respectively. I have created them using for loop ,i have looped for 48 times for each widget. This was succesfull and all the widgets were displayed on the screen as required.

    but in the callbacks of i need to set resources to these widgets, i could not find a way to do this since i need to point to specific widget ,i tried using the arrayi.e,Ptwidget_t array[48] and assigned widget names to this array but it is showing unsupported declaration.

  Can anyone suggest me a method to do this

If you are creating the widgets dynamically in code, you can save the widget pointer in an array.

PtWidget_t *widgets[NUMBER_WIDGETS];

for(i=0;…)
{
widgets[i] = PtCreateWidget(…);
}

If you create the widgets in PhAB and you want to put the widget pointers in an array, you can’t do it statically.

This doesn’t work:

PtWidget_t *widgets[] =
{
ABW_widget_1,
ABW_widget_2,

};

Instead, in the setup function of the windows, put in some static code as follows:

int setup(…)
{
widgets[0] = ABW_widget_1;
widgets[1] = ABW_widget_2;

}

Thaks maschoen for your reply,it helped me a lot now i have used below code

PtWidget_t *widgets[NUMBER_WIDGETS];

for(i=0;…)
{
widgets[i] = PtCreateWidget(…);
}

now my code is working properly and i am able to realize widgets and also handle callbacks effectively.

regards
Pradeep