Here's an example from DFL where I'm using an anonymous Scintilla object which is a subclass of a text editing widget in DFL (just another window subclass), but behind the scenes it actually loads the Scintilla DLL and behaves like a normal DFL text editing widget:
http://pastebin.com/YAduPRtF What really happens in DFL is that assiging the "parent" variable of a window class object (lets call it client) to another window class object (call it host) means that the host now holds a reference to the client. So the client will not be destroyed unless any of it's destroy methods are explicitly called, or if the host window is destroyed then the client window is destroyed as well (this is how DFL works). I think that's how it works. If I'm wrong someone can correct me, though. :) On 10/18/10, Stanislav Blinov <[email protected]> wrote: > 15.10.2010 19:43, Andrej Mitrovic wrote: >> Related: A nice alternative for quickly using anonymous objects is >> using the with statement, e.g.: >> >> with (new Foo) >> { >> foo(); >> // ... more code >> } >> >> And after the with block the object doesn't exist anymore. >> Or you could bind it to some internal reference and keep it there, > > I must ask, how can this binding be achieved? > >> which wouldn't destroy it after exiting the with block. Many of the DFL >> GUI >> library code samples work this way, and it's quite a nice syntax imo. > >
