Why my progress bar doesn't work? lazarus / 9-Editor ---------------------------------------------------------------------- Fernando M.; · 2006-03-20 02:27 To make progress bar work i only have to change its position right? Like... Code: [Select] progressbar1.Position := 25; Only this and my progress bar should change right? Well, it just does not work. ---------------------------------------------------------------------- Marc · 2006-03-20 11:38 Works here. What version of laz did you use and what platform and where did you place the code ? ---------------------------------------------------------------------- Anonymous · 2006-03-21 01:05 i'm using v0.9.13 beta on Debian Linux and i placed into something like this... procedure TForm1.Button1Click(Sender: TObject); begin   button1.Enabled := false;   groupbox1.Visible := true;   groupbox2.visible := true;   label6.visible := true;   progressbar1.Position := 25;     if FileExists('/usr/bin/teste') then        begin               progressbar1.position := 50;               label3.caption := 'Encontrado!';               label3.visible := true;               progressbar1.position := 75;        end     else        begin               progressbar1.position := 50;               label3.caption := 'Programa nao encontrado!';               progressbar1.position := 75;        end;     progressbar1.position := 100;     progressbar2.position := 10; ---------------------------------------------------------------------- felipemdc · 2006-03-21 01:19 The window isn´t painted until you process the paint messages sent by the operating system. After each change on visual properties, like the position of the progress bar, you should also process all messages on the quoue. Do this by calling: Application.ProcessMessages; ---------------------------------------------------------------------- Bart · 2006-03-21 12:11 Curious as to what you expected to see. As sekel said, you'r gonna need an Application.ProcessMessages after each change of position in order to see the change on screen. However, after clicking on Button1, the progressbar changes so rapidly (the code will run, I expect, in < 1 ms), and at the end will be in position 10. I expect you will only see the last position. After each change of position do a Application.ProcessMessages and then ShowMessage('Position changed') and take a look at the progressbar. Does it change? Bart ---------------------------------------------------------------------- Anonymous · 2006-03-21 20:32 no, it didn't changed any ideas? ---------------------------------------------------------------------- felipemdc · 2006-03-21 22:34 Can you show us your new code? ---------------------------------------------------------------------- Anonymous · 2006-03-22 11:47 procedure TForm1.Button1Click(Sender: TObject); begin   button1.Enabled := false;   groupbox1.Visible := true;   groupbox2.visible := true;   label6.visible := true;     label2.visible := true;     progressbar1.Position := 25;     Application.ProcessMessages;     ShowMessage('Position changed');     if FileExists('/usr/bin/teste') then        begin               progressbar1.position := 50;               label3.caption := 'Encontrado!';               label3.visible := true;               progressbar1.position := 75;        end     else        begin               progressbar1.position := 50;               label3.caption := 'Programa nao encontrado!';               progressbar1.position := 75;        end;     progressbar1.position := 100;     Application.ProcessMessages;     progressbar2.position := 1;     progressbar2.position := 10; ---------------------------------------------------------------------- Marc · 2006-03-22 13:25 I tried this and it works. The project I tested including screenshots of it you can find at: http://lazarus.dommelstein.nl/test/at5 ---------------------------------------------------------------------- Bart · 2006-03-22 15:59 I think you kind of missed the point I was making. Lets take'a new look at the problem. We will  try to reproduce it Make a new project. On the form drop Progressbar1 - Min = 0 - Max = 100 - Position = 0 - Enabled = True 4 buttons (button1 .. button4) Then use this code: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); begin   ProgressBar1.Position := 10; end; procedure TForm1.Button2Click(Sender: TObject); begin   ProgressBar1.Position := 30; end; procedure TForm1.Button3Click(Sender: TObject); begin   ProgressBar1.Position := 60; end; procedure TForm1.Button4Click(Sender: TObject); begin   ProgressBar1.Position := 90; end; Run the program. Press the buttons one by one Report what you see The progressbar should now work as expected. If it does not, please post screenshots of the progressbar after pressing all 4 buttons. Bart ---------------------------------------------------------------------- Anonymous · 2006-03-24 03:53 not working yet, i took a screenshot, look here (tried to show the source code behind it) http://nerfando.no-ip.org/fernando/ftp/linux1.jpg ---------------------------------------------------------------------- Bart · 2006-03-24 10:36 Can you upload the entire project (forms & units, not executable) somewhere? I will try and compile/run it on my Suse 10/Lazarus 0.9.12 and report back. If we cannot fix it, maybe ypu should report it as a bug. Bart ---------------------------------------------------------------------- Anonymous · 2006-03-27 23:49 Sorry, i was really busy those days. Here it is, take a look http://nerfando.no-ip.org/fernando/ftp/project.tar.gz Can you compile a program with progress bar working and send me? Just to test here. Thanks! ---------------------------------------------------------------------- Bart · 2006-03-30 10:01 I'll take a look at it, a bit to busy rigth now... Bart ---------------------------------------------------------------------- Bart · 2006-03-30 17:12 Quote from: "Anonymous"Sorry, i was really busy those days. Here it is, take a look http://nerfando.no-ip.org/fernando/ftp/project.tar.gz Can you compile a program with progress bar working and send me? Just to test here. Thanks! I downloaded, compiled an ran your program on my Suse Linux 10.0. It compiled and ran just fine. I put a copy of the compiled program and 4 pictures (resp. after pressing button 1..4) here for you: http://home-1.tiscali.nl/~knmg0017/devel/pbar.tar.gz Since I'm an absolute novice to linux, it took m e some time to understand how to un-tar etc. and then ftp-ing it all up... So thanks to you I learned a little bit more about Linux today ! Bart ---------------------------------------------------------------------- Marc · 2006-03-31 14:15 How did you create the tar.gz ? It doesn't seem to be valid (use tar -tvzf pbar.tar.gz to check) ---------------------------------------------------------------------- Anonymous · 2006-04-01 04:21 marc, try tar -zxvf pbar.tar.gz I swear i will register here and stop those guest posts ---------------------------------------------------------------------- Anonymous · 2006-04-01 04:25 you were right, the tar.gz isn't working ---------------------------------------------------------------------- Anonymous · 2006-04-01 14:12 I found the bug. It was on the gtk theme called blue curve. Chaging to them default works perfectely. Thanks for the help and the patience ---------------------------------------------------------------------- Bart · 2006-04-02 11:55 Quote from: "Marc"How did you create the tar.gz ? It doesn't seem to be valid (use tar -tvzf pbar.tar.gz to check) Well I used tar -czvf to create the tarfile..., so I did it wrong did I? OK next time I'm on linux I'll do a man tar ... Anyhow, glad to see OP's problem solved. Bart ---------------------------------------------------------------------- Marc · 2006-04-03 16:20 Quote from: "Bart"Quote from: "Marc"How did you create the tar.gz ? It doesn't seem to be valid (use tar -tvzf pbar.tar.gz to check) Well I used tar -czvf to create the tarfile..., so I did it wrong did I? That should be OK. c -> Create, t -> Test, x -> eXtract I get errors on the second and third file. Quote Anyhow, glad to see OP's problem solved. Bart Glad too. ---------------------------------------------------------------------- Bart · 2006-04-05 14:18 Quote from: "Marc"Quote from: "Bart"Quote from: "Marc"How did you create the tar.gz ? It doesn't seem to be valid (use tar -tvzf pbar.tar.gz to check) Well I used tar -czvf to create the tarfile..., so I did it wrong did I? That should be OK. c -> Create, t -> Test, x -> eXtract I get errors on the second and third file. FWIW Since I had the original pbar.tar.zg still on disk, I tried to extract the files, which went well. So then I downloaded the tarfile I uploaded myself, only to discover that the files were not Identical. So something went wrong in the ftp file transfer. I replaced the file on my homepage with a working one, for anyone who cares (hardly likely since OP's problem is solved) :lol: Well, I had fun anyway! Bart