delphi - ProgresBar - display message after the bar reaches 100% -


i playing around progress bars ... trying display message when progress bar reaches end of line (100%) ( used raize status bar , tms advprogressbar) raize, code sample seem work :

procedure tform1.timer1timer(sender: tobject); begin   rzprogressstatus1.percent := rzprogressstatus1.percent +1;   if rzprogressstatus1.percent = 100 begin     showmessage('yo');     application.terminate;   end; end; 

however,for advprogressbar not because keeps firing messages when position reaches 100.that makes me worry if raize maybe in trouble.

procedure tform1.timer1timer(sender: tobject); begin   advprogressbar1.position := advprogressbar1.position +1;   if advprogressbar1.position = 100 begin     showmessage('yo');     application.terminate;   end; end; 

edit : debugger shows :

first chance exception @ $00649d6c. exception class $c0000005 message 'access violation @ 0x00649d6c: read of address 0x00000048'. process project1.exe (2928) , stops on following code :

procedure ttimer.setenabled(value: boolean); begin   if value <> fenabled begin     fenabled := value;     updatetimer;   end; end; 

like said,i display message when bar reaches end , terminate application. missing here ? there better way ?

if need use timer , time consuming (showing dialog time consuming) should turn timer off @ start of timer event , turn on again @ end (if neccessary)

procedure tform1.timer1timer(sender: tobject); begin   timer1.enabled := false;   advprogressbar1.position := advprogressbar1.position +1;   if advprogressbar1.position = 100 begin     showmessage('yo');     application.terminate;   end;   timer1.enabled := true; end; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -