ListView with progress bars lazarus / 31-LCL ---------------------------------------------------------------------- Dibo · 2010-12-09 18:39 Hi, I'm trying to draw ProgressBar on ListView items. I can't find any tutorial for lazarus TListView so I use this: http://delphi.about.com/library/weekly/aa053105a.htm But it doesn't work. No progress bar is showing. Is it a bug or Lazarus have different concept for this? Regards Ubuntu 10.10 64bit, GTK 2. Lazarus 0.9.29 from SVN, revision 28558. FPC 2.5.1 from SVN, revision 16476 ---------------------------------------------------------------------- u2o · 2015-03-31 04:49 Really late, but it's to help those who have this problem... Works in the following way... Add two Buttons and one ListView Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   r: TRect;   pb: TProgressBar; begin   Listview1.ViewStyle         := vsReport;   Listview1.Columns.Add.Width := Round(Listview1.Width / 4);   Listview1.Columns.Add.Width := Round(Listview1.Width - Listview1.columns[0].Width) - 22;   Listview1.Items.Add.Caption := 'Text';   r := Listview1.Items[0].DisplayRect(drBounds);   r.Left  := r.Left + Listview1.columns[0].Width;   r.Right := r.Left + Listview1.columns[1].Width;   pb := TProgressBar.Create(Self);   pb.Parent := Listview1;   pb.BoundsRect := r;   pb.Position := 5;   Listview1.Items[0].Data := pb; end; // Change the ProgressBar Position // ProgressBar Position ändern procedure TForm1.Button2Click(Sender: TObject); var   pb: TProgressBar; begin   pb := TProgressBar(Listview1.Items[0].Data);   pb.StepIt; end; ---------------------------------------------------------------------- zeljko · 2015-03-31 09:11 Isn't it better to use OwnerDraw, and paint themed progressbar inside listview item ? With your solution you must think of scrolling too (each visible progressbar you must move manually when listview is scrolled). ---------------------------------------------------------------------- darkdata · 2015-03-31 18:31 Here are some delphi examples of drawing it: http://stackoverflow.com/questions/7044125/delphi-draw-own-progress- bar-in-list-view I haven't done it with LCL yet but I am interested. ---------------------------------------------------------------------- fpcoder · 2015-03-31 20:27 Works under Windows. The unit 'windows' is used though, so I guess its not cross platform? Quote from: darkdata on March 31, 2015, 08:31:00 pmHere are some delphi examples of drawing it: http://stackoverflow.com/questions/7044125/delphi-draw-own-progress- bar-in-list-view I haven't done it with LCL yet but I am interested. ---------------------------------------------------------------------- u2o · 2015-08-26 10:06 I've found a cute way to show percentages in full color, using the event BeforeCellPaint on a TVirtualStringTree. This colored progress is not affected by the Windows theme, looks exactly like in the attached image on Windows XP, 7, 8 or 10 (not tested on linux). My code is a mess, apologize for not providing demo at this time. In a few days I'll do that.