Ok, I just ran across some documentation in Lengthy Operations saying that
during a callback widgets aren’t redrawn… Bummer.
But life goes on…
So I am now trying one of the suggestions in Lengthy Operations which is to
create a timer on the fly. When the timer expires it should call a callback
to run my function. However its not working.
Here’s a code snippet…
PtWidget_t *timer;
int timer_cb ( PtWidget_t *, void *, PtCallbackInfo_t *);
…
timer = PtCreateWidget(PtTimer, Pt_DFLT_PARENT, 0, NULL);
PtAddCallback(timer, Pt_CB_TIMER_ACTIVATE, timer_cb, NULL);
PtSetResource(timer,Pt_ARG_TIMER_INITIAL,time,0 );
return( Pt_CONTINUE );
}
int timer_cb( PtWidget_t *widget, void *apinfo, PtCallbackInfo_t *cbinfo )
{
while (1)
{
incBar(1);
delay(50);
}
}
I know that incBar is working because I have another button which calls that
function directly and it works.
I guess my question is, If I set the initial time of my timer, does that
start the timer? Or do I have to start it?
thx
Eric
Eric Winger wrote:
I’m trying to get a progress bar to increment itself by one x iterations
when a seperate button is pressed. Each increment is seperated by a
short delay so I can see the progress.
But unfortunately, the progress bar will only update itself after the
button press has completed its x number of iterations.
Eventually, I want my button press to start a thread that will increment
the progress bar in the background, one increment at a time. But when I
went down this path, my application kept dying.
However, in the meantime, I’d settle for just being able to see the for
loop increment the progress bar visually one step at a time. I’ve tried
using PtDamageWidget(), thinking that the damage event would force an
immediate redraw, but with no success. I would like to be able to force
a widget redraw on demand.
Any ideas?
thx
Eric
–
I’d change the world if I could remember my password
–
I’d change the world if I could remember my password