![]() |
VirtualTree problems. Soft-gems = no support at all.
Hello,
I found this board that someone referred to on the VST forum, since that one is pretty much dead. I'm having a problem with drawing Images in my tree. when I draw the items, it's all fine, but the OnafterPaint event is always triggered, so it keeps refreshing the images. (I cannot use an Timagelist since it's giving me problems when i am loading 4700 icons in it) So the question is: Is there an option to disable all the onpaint / onafterpaint / ongettext when the mouse moves? things keeps refreshing with the wrong info on certain lines, since it's not getting the correct info, if you are moving the mouse too fast it's reading the wrong row. thank you very much for your help Perry |
Re: VirtualTree problems. Soft-gems = no support at all.
Hi Perry,
Just an idea: Have you tried using several imagelists? You can then assign them in OnGetImageIndexEx. |
Re: VirtualTree problems. Soft-gems = no support at all.
VST isn't dead (but the forum is :)). The development ist still going on
![]() Just a few days ago, they accepted a patch from us. So, if there is a problem with the code of the VST, try posting an issue (with a demo showing your problem) there and i'm sure you'll get help. |
Re: VirtualTree problems. Soft-gems = no support at all.
Zitat:
Zitat:
|
Re: VirtualTree problems. Soft-gems = no support at all.
Hi,
I posted several months ago on the Forum there. (perry4916) and no response. so yes, I mean the Forum seems to be dead. Don't know about the program itself. To Benjamin " Just an idea: Have you tried using several imagelists? You can then assign them in OnGetImageIndexEx. " I guess I don't know how to use the "ongetimageindexex" ? problem i was having at that time is that i have 4700 icons. when i am loading them into a Timagelist, it takes a looooong time, and i will get "out of resources" error. So, I created a cache file (basicly 1 BMP) that had all the images next to eachother. the filesize became 10 Mb and the image size was something like 4302249 x 23943 I was able to read that 1 picture into a timagelist and it automaticly splits the images for me. but then also, i was getting randomly weird errors, "out of memory" "out of resource" etc so I gave up. So i am trying to find the best solution for it. So now I have this on a event and works great. but when you move the mouse, it's showing other icons on top of the 1 row i selected. cause it's getting triggered everytime i move the mouse. and if your going to fast it's not getting the proper X,Y information
Delphi-Quellcode:
procedure Tdsmainform.perrytreeAfterItemPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; ItemRect: TRect); procedure DrawIcon; var w, X, Y, i: Integer; BlobStream: TStream; Datap: ptreedata; begin try statusbar.caption:=inttostr(y); Datap := Sender.GetNodeData(Node); imagequery.SQL.Clear; imagequery.SQL.Text:= 'SELECT * FROM pic where romnumber = "'+datap.romscenenumber+'"'; imagequery.Open ; imagequery.first; if imagequery.RecordCount=0 then exit; if imagequery.FieldByName ('picc').IsNull then exit; tempBmp.Width := 32; tempBmp.Height := 32; //tempbmp.PixelFormat := pf24Bit; BlobStream := imagequery.CreateBlobStream(imagequery.FieldByName('picc'),bmRead); try apng.LoadFromStream(BlobStream); finally BlobStream.Free; end; tempBmp.Canvas.Draw(0, 0, aPng); resizebmp(tempbmp,newiconbmp,24,24); X := ItemRect.Left + TVirtualStringTree(Sender).Margin; Y := ItemRect.Top + 2; if perrytree.Header.Columns.Items[0].CaptionText='Icon' then x:=x+ perrytree.Header.Columns.Items[0].Left; TargetCanvas.Draw(X, Y, newiconbmp); except on E: EStreamError do ShowMessage(lang1108); on E: EInvalidGraphic do ShowMessage(lang1109); end; end; begin DrawIcon; end; |
Re: VirtualTree problems. Soft-gems = no support at all.
Delphi-Quellcode:
procedure TForm1.VSTListeGetImageIndexEx(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: Integer; var ImageList: TCustomImageList); begin Case Something of ... // e.g. if Column = 1 then take Imagelist1 // *or* if that node has a special flag, take Imagelist2 etc.. 1: ImageList := ImageList1; 2: ImageList := ImageList2; end; end; |
Re: VirtualTree problems. Soft-gems = no support at all.
maybe there is too much lag at your paintmethod, so the global(cause out of systemresources?) aPng/tempbmp/newiconbmp will be overwritten before finished the paint and the output becomes undefined.i solved this imagelist problem, using a pretty quick pointerlist to a recordtype of my images. it works up to 6000-7000 bitmaps. to get more, i sequencially load and free them, depending on the first and last visible items.always watch your variables not to be overwritten
too quick from the next call. |
Re: VirtualTree problems. Soft-gems = no support at all.
Zitat:
do you load all your images first into a recordset? but doesn't that take long? how did you do it? Thank you |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:54 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz