On 6/13/07, Hakki Dogusan <[EMAIL PROTECTED]> wrote: > Hi, > > John Labenski wrote: > > [snip] > > Anyway... The name of this function, "Delete()", is *very* generic and > > will probably conflict with some class function eventually and I'm > > surprised it hasn't already. > > o = wx.wxXXX(...) > o:Destroy() is better due to wx naming? > > - If XXX class has a cpp Destroy method, it is already doing what we want > - If not then we supply this method for Lua
The Destroy() that wxWidgets uses for it's wxObject classes usually only deletes the ref data, but does nothing to the object. The Destroy() for wxWindows uses delayed deletion and is fairly unique to wxWidgets, I think. This is valid img = wx.wxImage(10,10); img:Destroy(); img:Create(10,10); This is special to wxWidgets win = wx.wxWindow(...); win:Destroy(); win:Create(...) <- should fail Some of the changes I've been making are to make things a little less wxWidgets centric so that other libraries can be easily wrapped (changing they way baseclass functions are called for example). This may not ever materialize, but I don't want some of the special notation we've used cause problems. > > What if we rename it to "delete()", lower case, since that is a NOT a > > valid name for a class member function (I just tried it) and so there > > cannot be a conflict with anything that ever gets bound by wxLua. > > > > This will also match the "new(...)" function that you can now use for > > class constructors. > > Is it possible to have both? > > new - delete > ... - Destroy The Destroy() function will of course exist for any class that defines it itself. The delete() function will be new and special to classes that are designed to be able to deleted. In fact I was going to create a separate global wx.delete(object) function (I hope it's possible) to delete any userdata object. Currently you cannot delete a wxMenu you've created. For example: (this really shouldn't happen, but maybe for some strange reason someone may want to do this) menu = wx.wxMenu() -- not attached to a parent so nobody will ever delete this. menu:delete() -- fails since you should almost never delete a menu so we won't have this function. wx.delete(menu) -- now you can delete it to avoid a memory leak. Regards, John Labenski ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users