Callback in code

hi there,

how do i implement callbacks in my code withouth creating them in the PhAB itself

i tried some things with PtAddCallbacks() but it diddnt work =(

and where do i have to put my functions? in the abmain? or create an extern .c file? my goal is to have all the programm code in one file, all functions etc…

would be nice if someone knows more about it

btw: qnx 4

Create your callback function:

static int my_cb(PtWidget *wgt, void *data, PtCallbackInfo_t*info)
  // whatever you wanted to do
  return Pt_CONTINUE;

Then add it to whatever widget is appropriate:

void my_func()
  PtCallback_t cb;
  PtArg_t args[1];

  cb.event_f = my_cb; = NULL; // unless you want to pass data to your callback func

   PtSetArg(&args[0], Pt_CB_WHATEVER_CB, &cb, 1 );
   PtSetResources(your_widget, 1, args );

Don’t put the code in any ab*.c or ab*.h files since these are generated.

Hope this helps,