Re: type casts (FindWindow)
Bryan Bulten <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.wxnet |
|---|---|
| Message-ID | <[email protected]> |
> currently wx.Window.FindWindow() returns a "Window".
> If I know it is a "ListBox", how do I convert the
> return value?
This goes back to when I was asking about RTTI and wxWindows.
The method, Object::CreateFromObject is used to look up the wxWindow
object type using a typemap similar to the one used with
Event::CreateFrom.
The only difference is that the one in Object uses the class's type
information.
I realize now that this is only a temporary solution, since the typemap
is unaware of sub-classed controls. I'm not sure of a good way of
getting around this.
One possible solution would be to keep a static Hashtable of all the C++
objects, and their associated C# objects. Then in the constructor of
Object, add the references to the static Hashtable:
classtable.Add(wxObject, this);
Then use this whenever we need a reference to a C++ object:
Object o = classtable[classptr];
The problem in doing this, is that there isn't much of a way for us to
tell which C++ objects have been removed, and which ones are still
needed.
Any ideas?
--
Bryan Bulten
http://opendev.ods.org/
http://wxnet.sourceforge.net/
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+qhs932WFWIzmzHgRAlZvAJ4tlpBjng8qCyFfB+aEw98qnN3zywCeL0Y9 7zj4dixQaDzrxONnGAGjiio= =nFet -----END PGP SIGNATURE-----