Re: progress bar
- Posted by "Hayden McKay" <hmck1 at dodo.com.au> Dec 08, 2003
- 446 views
--=======AVGMAIL-3FD471790AA9======= ------=_NextPart_000_000F_01C3BDE4.CD68DAA0 I fixed it by replacing setScrollPos( ProgressBar29, curpos ) > >setText(LText28, sprintf("%d%% (%d)", > > {floor(100*curpos/currange[2]),curpos})) with setScrollPos( ProgressBar29, curpos ) > >setText(ProgressBar29, sprintf("%d%% (%d)", > > {floor(100*curpos/currange[2]),curpos})) The progressbar is updated 14 times. In the onActivate procedure. When the proggie opens it reads a heap of files. The onActivate procedure uses "call_proc(progbar,{})" to read files and updates the bar. All seems to be working properly now. U were right about not working after WinMain( Window1,Normal ) I made a little test proggie to work out the bar. And now I look at it again and WinMain( Window1,Normal ) was after setScrollPos( ProgressBar29, curpos ) > >setText(LText28, sprintf("%d%% (%d)", > > {floor(100*curpos/currange[2]),curpos})) some reason I thought this was after WinMain( Window1,Normal ) ----- Original Message ----- setScrollPos( ProgressBar29, curpos ) > >setText(LText28, sprintf("%d%% (%d)", > > {floor(100*curpos/currange[2]),curpos})) From: "Derek Parnell" <ddparnell at bigpond.com> To: <EUforum at topica.com> Sent: Monday, December 08, 2003 10:29 PM Subject: Re: progress bar > ============ The Euphoria Mailing List ============ > > > ----- Original Message ----- > >From: Hayden McKay > >To: EUforum at topica.com > >Sent: Monday, December 08, 2003 9:43 PM > >Subject: progress bar > > > > > >Im using this syntax to display my progress bar; > > > >> > > >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 > > --^---------------------------------------------------------------- > This email was sent to: hmck1 at dodo.com.au > > EASY UNSUBSCRIBE click here: http://topica.com/u/?b1dd66.b60Ray.aG1jazFA > Or send an email to: EUforum-unsubscribe at topica.com > > TOPICA - Start your own email discussion group. FREE! > http://www.topica.com/partner/tag02/create/index2.html > --^---------------------------------------------------------------- > > > -- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.548 / Virus Database: 341 - Release Date: 5/12/03 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.548 / Virus Database: 341 - Release Date: 5/12/03 ------=_NextPart_000_000F_01C3BDE4.CD68DAA0 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1276" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=Arial size=2>I fixed it by replacing</FONT></DIV> <DIV><FONT face=Arial size=2>setScrollPos( ProgressBar29, curpos )<BR>> >setText(<FONT color=#ff0000><STRONG>LText28</STRONG></FONT>, sprintf("%d%% (%d)",<BR>> > {floor(100*curpos/currange[2]),curpos}))</FONT></DIV> <DIV><FONT face=Arial size=2>with</FONT></DIV> <DIV><FONT face=Arial size=2>setScrollPos( ProgressBar29, curpos )<BR>> >setText(<STRONG><FONT color=#ff0000>ProgressBar29</FONT></STRONG>, sprintf("%d%% (%d)",<BR>> > {floor(100*curpos/currange[2]),curpos}))</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>The progressbar is updated 14 times. In the onActivate procedure.</FONT></DIV> <DIV><FONT face=Arial size=2>When the proggie opens it reads a heap of files.</FONT></DIV> <DIV><FONT face=Arial size=2>The onActivate procedure uses "call_proc(progbar,{})" to read files and updates the bar.</FONT></DIV> <DIV><FONT face=Arial size=2>All seems to be working properly now.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>U were right about not working after WinMain( Window1,Normal )</FONT></DIV> <DIV><FONT face=Arial size=2>I made a little test proggie to work out the bar. And now I look at it again and</FONT></DIV> <DIV><FONT face=Arial size=2>WinMain( Window1,Normal ) was after</FONT></DIV> <DIV><FONT face=Arial size=2>setScrollPos( ProgressBar29, curpos )<BR>> >setText(<FONT color=#ff0000><STRONG>LText28</STRONG></FONT>, sprintf("%d%% (%d)",<BR>> > {floor(100*curpos/currange[2]),curpos}))</FONT></DIV> <DIV><FONT face=Arial size=2>some reason I thought this was after WinMain( Window1,Normal )</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2> </DIV> <DIV><BR><BR></DIV></FONT> <DIV><FONT face=Arial size=2>----- Original Message ----- setScrollPos( ProgressBar29, curpos )<BR>> >setText(LText28, sprintf("%d%% (%d)",<BR>> > {floor(100*curpos/currange[2]),curpos}))<BR></FONT> <DIV><FONT face=Arial size=2>From: "Derek Parnell" <</FONT><A href="mailto:ddparnell at bigpond.com"><FONT face=Arial size=2>ddparnell at bigpond.com</FONT></A><FONT face=Arial size=2>></FONT></DIV> <DIV><FONT face=Arial size=2>To: <</FONT><A href="mailto:EUforum at topica.com"><FONT face=Arial size=2>EUforum at topica.com</FONT></A><FONT face=Arial size=2>></FONT></DIV> <DIV><FONT face=Arial size=2>Sent: Monday, December 08, 2003 10:29 PM</FONT></DIV> <DIV><FONT face=Arial size=2>Subject: Re: progress bar</FONT></DIV></DIV> <DIV><FONT face=Arial><BR><FONT size=2></FONT></FONT></DIV> <DIV><FONT face=Arial size=2>> ============ The Euphoria Mailing List ============ <BR>> <BR>> <BR>> ----- Original Message ----- <BR>> >From: Hayden McKay <BR>> >To: </FONT><A href="mailto:EUforum at topica.com"><FONT face=Arial size=2>EUforum at topica.com</FONT></A><FONT face=Arial size=2> <BR>> >Sent: Monday, December 08, 2003 9:43 PM<BR>> >Subject: progress bar<BR>> ><BR>> ><BR>> ><BR>> >Im using this syntax to display my progress bar;<BR>> ><BR>> >> ><BR>> >this is in procedure Window1_onActivate (integer self, integer event, sequence params)<BR>> ><BR>> >The progress bar displays in text format eg: 56%(56)<BR>> >How do I get the progress bar to fill instead.<BR>> ><BR>> >If I move the <BR>> >setScrollPos( ProgressBar29, curpos )<BR>> >setText(LText28, sprintf("%d%% (%d)",<BR>> > {floor(100*curpos/currange[2]),curpos}))<BR>> >to after <BR>> >WinMain( Window1,Normal )<BR>> ><BR>> >Then it works but I'd rather have it in<BR>> >Window1_onActivate (integer self, integer event, sequence params)<BR>> <BR>> I dispute that it "works" when placed after the WinMain() call, because by the time WinMain() returns, all your windows are closed and destroyed. <BR>> <BR>> 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. <BR>> <BR>> 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.<BR>> <BR>> 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.<BR>> <BR>> -- <BR>> Derek<BR>> <BR>> --^----------------------------------------------------------------<BR>> This email was sent to: </FONT><A href="mailto:hmck1 at dodo.com.au"><FONT face=Arial size=2>hmck1 at dodo.com.au</FONT></A><BR><FONT face=Arial size=2>> <BR>> EASY UNSUBSCRIBE click here: </FONT><A href="http://topica.com/u/?b1dd66.b60Ray.aG1jazFA"><FONT face=Arial size=2>http://topica.com/u/?b1dd66.b60Ray.aG1jazFA</FONT></A><BR><FONT face=Arial size=2>> Or send an email to: </FONT><A href="mailto:EUforum-unsubscribe at topica.com"><FONT face=Arial size=2>EUforum-unsubscribe at topica.com</FONT></A><BR><FONT face=Arial size=2>> <BR>> TOPICA - Start your own email discussion group. FREE!<BR>> </FONT><A href="http://www.topica.com/partner/tag02/create/index2.html"><FONT face=Arial size=2>http://www.topica.com/partner/tag02/create/index2.html</FONT></A><BR><FONT face=Arial size=2>> --^----------------------------------------------------------------<BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> <BR>> -- <BR>> Incoming mail is certified Virus Free.<BR>> Checked by AVG anti-virus system (</FONT><A href="http://www.grisoft.com"><FONT face=Arial size=2>http://www.grisoft.com</FONT></A><FONT face=Arial size=2>).<BR>> Version: 6.0.548 / Virus Database: 341 - Release Date: 5/12/03<BR>> </FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2><BR>---<BR>Outgoing mail is certified Virus Free.<BR>Checked by AVG anti-virus system (<A href="http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: 6.0.548 / ------=_NextPart_000_000F_01C3BDE4.CD68DAA0-- --=======AVGMAIL-3FD471790AA9======= Content-Type: text/plain; x-avg=cert; charset=iso-8859-2 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Description: "AVG certification" Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.548 / Virus Database: 341 - Release Date: 5/12/03 --=======AVGMAIL-3FD471790AA9=======--