[Lazarus] How to draw a progressbar under a column of a listview?

lonelycorn yanchengyuan at gmail.com
Sun Apr 12 18:07:54 CEST 2009


i was busy these days doing some homework,so sorry to be late.
i've done as you told and in fact there is no reply from the code.i
think this means that lazarus didn't even execute the codes.
Here are the results i got:
"
Gtk-WARNING **: Failed to load module "libcanberra-gtk-module.so":
libcanberra-gtk-module.so: cannot open shared object file: 没有该文件或
目录
[WARNING] Out of OEM specific VK codes, changing to unassigned
[WARNING] Out of unassigned VK codes, assigning $FF
"
the Chinese means that "there is no such file or directory"

i'm using lazarus 0.9.26.4 from a ubuntu (jaunty--beta) third-party source 
.fpc version is 2.2.2-8
and i have to say that since lazarus 0.9.26 the synedit looks awful after re-compiled with GTK2.
i mean that the letters weren't displayed correctly-there were some missing;and when highlighted,the 
letters that were once missing appeared again!.that is the same with lazarus 0.9.26.2 and 0.9.26.4
 

在 2009-04-11六的 08:43 +0200,Graeme Geldenhuys写道:
> 2009/4/11 闫程远 <yanchengyuan at gmail.com>:
> > first i wanted to draw a progressbar.i know there is a method of a TListItem
> > called "DisplayRect",but whatever i do,the rect it returns is (0,0,0,0)
> 
> As far as I can see you have found a bug. Please report this in Mantis.
> 
> I have tried the following code and the DisplaySubItemRect() is also
> always (0,0,0,0). The other thing is that I use Sender
> (TCustomListView type) to retrieve the canvas. If the code below runs,
> the whole Form is painted Green, whereas at least it should only have
> been inside the ListView.
> 
> I use Lazarus (latest trunk revision) with GTK2 widgetset.  Can you
> try to reproduce this and give feedback?
> 
> Steps to reproduce:
> -----------------------------
> * New LCL application
> * Drop TListView on form
> * Create 3 new items.
> * Create 1 new subitem for each item.
> * Add the event handler below
> * Run from command line (so writeln() statements work)
> 
> ===================================
> procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
> Item: TListItem;
>   SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean);
> var
>   rect: TRect;
> begin
>   writeln('CustomDrawSubItem');
>   if Item.Caption = 'Item1' then
>   begin
> //    if cdsDefault in State then
>     begin
> //      DefaultDraw := False;
>       Rect := Item.DisplayRectSubItem(SubItem, drBounds);
>       writeln('r.right = ', rect.Right);
>       Brush.Color := clGreen;
>       Rect.Right := Trunc(Rect.Right * 0.75); // 75%
>       Sender.Canvas.FillRect(Rect);
>     end;
>   end;
> end;
> ===================================
> 
> > and whatever i wrote for the drawsubitem/drawitem method it just doesn't
> > work.
> > then i tried to put a Tprogressbar under a column,and it failed again.
> > can anyone help me?
> >
> > regard,
> > Yan Chengyuan
> >
> > --
> > I'm sure that I will win.
> >
> > _______________________________________________
> > Lazarus mailing list
> > Lazarus at lazarus.freepascal.org
> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> >
> >




More information about the Lazarus mailing list