On 5/10/05, Rob Kennedy <[EMAIL PROTECTED]> wrote: > Having a tree object to manage all its nodes would probably be a good > idea anyway. I'm surprised you haven't needed one sooner.
I'm a new programmer that has been learning things on discussion lists, so I'm still creating my own tools and improving old code :) I've already made a tree here, I'm just improving its performance and looking for bugs ;] > There is a standard Windows interface, IStream, and Delphi provides a > class that adapts a TStream instance to that interface, TStreamAdapter, > in the Classes unit. Rewrite your tree-node classes to use an IStream > instead of a TStream, and then create a TStreamAdapter to wrap your > TFileStream instance. It's true!!! I saw it one hour after I sent this message... I'll just copy the ideas and implement my own TStreamAdapter to avoid using extra code and I see it also uses the "stdcall" to be compatible with COM stuffs, which will slow down my application... I'm storing something like 30-60mb in each "tree file"... It's not slow at all, but it isn't very fast either... > It's hard to tell without seeing your code. Merely declaring something > as implementing an interface doesn't magically make it destroy itself. > You need to tell it to destroy itself when it reference count reaches > zero. You also have to refer to the object via an interface variable, > not an object variable. Reference counting occurs as interface variables > go into and out of scope; if there are no interface variables, then > there are no references to count. Yeah, I discovered this... Sorry for not sending code, I thought my mistake was on the class declaration ;] I was making something like this on the formCreate: FS : TInterfacedStream; ----- FS := TInterfacedStream.Create(...); //there's no "FS.Free" ;] And then I was expecting my overrided destroy to be called after the formCreate went out of scope... But even the _addRef wasn't getting called... But when I used: FS: IInterface; It worked!!! Then I discovered that I have to use an Interface variable... But since my class just implements IInterface - which has no usefull methods for me hehe - I saw that I'll have to implement an Interface and looked for "IFileStream, IStream, etc" and I also found the TStreamAdapter :) Anyway, thanks... Your msg would have helped me before, but at least now I see that I'm following the right way :) -- "ME ALIMENTE [http://br-linux.org/noticias/002750.html] hehe" "Invente, Tente!!! Fa�a um c�digo eficiente" (Jonas Raoni haha) Jonas Raoni Soares Silva --------------------------- Desenvolvedor de aplica��es jonasraoni at gmail dot com http://www.joninhas.ath.cx:666 ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

