get name widget in action

Hi I have widgets: PtText1,PtText2,PtText3 … and i want use the same function on each widgets. The function must get name widget for example PtText1 split this String and return only numer in this case “1”. And get value from PtText1(for example “0”) and set this value in variable like this pgmData[1] = 0;

int
myfunction(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo)
{

PtSetArg(&arg[0],Pt_ARG_TEXT_STRING,&textp,0);
PtGetResources(ABW_PtText1,1,arg);

pgmData[???] = ???

widget = widget,apinfo = apinfo,cbingo = cbinfo;
return(Pt_CONTINUE);
}

All widgets have a generic “data” resource. You could set this resource, for example to 1 for PtText1 at initalization time and read it back in your function. An alternative would be to have a callback for each widget. That callback would call your function but with a fourth parameter.