attaching callback of a widget inside a class member functio

I tried to attach a callback inside a member function, it says the callback
function has to be static, but if i change to static, none of the variables
can be accessed from that static function… codes are as following:

I tried to create a widget and attach an call back to it… it says the call
back function has to be static, then if i change it to static, it says it
can’t access
any of the non-static variables… any suggestion?

void RtProgressWidgetType :: Initialize(PtWidget_t* ParentWidget)
{
PtSetArg(&args[0], Pt_ARG_TIMER_INITIAL, 500, 0);
PtSetArg(&args[1], Pt_ARG_TIMER_REPEAT, 100, 0);
Timer = PtCreateWidget(PtTimer, ParentWidget, 2, args);
PtAddCallback(Timer, Pt_CB_TIMER_ACTIVATE, (PtCallbackF_t*)Timer_Repeat_CB,
NULL);
PtRealizeWidget(Timer);
}

Hello Ran

Can you post the declaration fot the Timer_Repeat_CB function?

Thanks
Rodney

ran zhang <rzhang@vamcointernational.com> wrote:

I tried to attach a callback inside a member function, it says the callback
function has to be static, but if i change to static, none of the variables
can be accessed from that static function… codes are as following:

I tried to create a widget and attach an call back to it… it says the call
back function has to be static, then if i change it to static, it says it
can’t access
any of the non-static variables… any suggestion?

void RtProgressWidgetType :: Initialize(PtWidget_t* ParentWidget)
{
PtSetArg(&args[0], Pt_ARG_TIMER_INITIAL, 500, 0);
PtSetArg(&args[1], Pt_ARG_TIMER_REPEAT, 100, 0);
Timer = PtCreateWidget(PtTimer, ParentWidget, 2, args);
PtAddCallback(Timer, Pt_CB_TIMER_ACTIVATE, (PtCallbackF_t*)Timer_Repeat_CB,
NULL);
PtRealizeWidget(Timer);
}

Adam:
This is the declaration of my cb…someone told me to pass the ‘this’
pointer as part of the callback data… not sure exactly what they meant.
maybe u can help me out.


static void RtProgressWidgetType :: Timer_Repeat_CB()
{
}

Gui Group <gui@qnx.com> wrote in message news:9qh9e6$eg7$1@nntp.qnx.com

Hello Ran

Can you post the declaration fot the Timer_Repeat_CB function?

Thanks
Rodney

ran zhang <> rzhang@vamcointernational.com> > wrote:
I tried to attach a callback inside a member function, it says the callback
function has to be static, but if i change to static, none of the variables
can be accessed from that static function… codes are as following:

I tried to create a widget and attach an call back to it… it says the call
back function has to be static, then if i change it to static, it says it
can’t access
any of the non-static variables… any suggestion?

void RtProgressWidgetType :: Initialize(PtWidget_t* ParentWidget)
{
PtSetArg(&args[0], Pt_ARG_TIMER_INITIAL, 500, 0);
PtSetArg(&args[1], Pt_ARG_TIMER_REPEAT, 100, 0);
Timer = PtCreateWidget(PtTimer, ParentWidget, 2, args);
PtAddCallback(Timer, Pt_CB_TIMER_ACTIVATE, (PtCallbackF_t*)Timer_Repeat_CB,
NULL);
PtRealizeWidget(Timer);
}
\