Re: wxCaret
- Posted by Matt Lewis <matthewwalkerlewis at ?mail.com> May 06, 2008
- 690 views
Greg Haberek wrote: > > Matt, > > I added the routines for wxCaret to wxEuphoria.cpp. I hope I did it right > this time, everything compiled fine. It compiled? Ship it!
object WXEUAPI new_wxCaret( object params ) { int parent = get_int( params, 1 ); int x = get_int( params, 2 ); int y = get_int( params, 3 ); wxCaret * caret = new wxCaret( ((wxWindow*) parent), x, y ); return BOX_INT( caret ); }
Looks good, except that you also need to deref and sequence that's passed. You can use wxDerefDS if you know it's a double or a sequence, and wxDeRef if it's an atom that might be an integer: wxDeRefDS( params ); wxDeRef( params ); You can actually make these calls at the top of the function. wxEuphoria won't dereference these (they always have a refcount of at least 2 or 3 by the time wxEuphoria sees it). Euphoria will free it after control returns from the call. If you don't do this, you'll end up leaking memory. I added you as a developer to the project, so go ahead and make those changes and commit... Matt