Re: progress bar

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message ----- 
>From: Hayden McKay 
>Subject: progress bar
>
>
>
>Im using this syntax to display my progress bar;
>
>setScrollPos( ProgressBar29,  curpos )
>setText(LText28, sprintf("%d%% (%d)",
>                     {floor(100*curpos/currange[2]),curpos}))
>
>this is in procedure Window1_onActivate (integer self, integer event, sequence
>params)
>
>The progress bar displays in text format eg: 56%(56)
>How do I get the progress bar to fill instead.
>
>If I move the 
>setScrollPos( ProgressBar29,  curpos )
>setText(LText28, sprintf("%d%% (%d)",
>                     {floor(100*curpos/currange[2]),curpos}))
>to after 
>WinMain( Window1,Normal )
>
>Then it works but I'd rather have it in
>Window1_onActivate (integer self, integer event, sequence params)

I dispute that it "works" when placed after the WinMain() call, because by the
time WinMain() returns, all your windows are closed and destroyed.

The Activate event only occurs once, after a window is opened. It is not
normally the right place to put a progress bar update. In the Activate event, you
might call setScrollRange(ProgressBar29, 1, 100) to set the low and hiogh limits
of the progrssbar's scrolling range.

You would call setScrollPos(ProgressBar29,  curpos ) in the routine that updates
'curpos'. You might need a doEvents(0) call if this in a loop within an event
handler.

I can see you have used some code from the demo program 'progressbar.exw", and
if you notice in that demo, the progress bar gets updated every Tick, not just
when the window is activated.

-- 
Derek

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu