I had problems downcasting from wxClientData* to SourceInfo*. I ran through the RTTI section in the docs and I got a solution which appears to be working -- but RTTI is all kind of new ground for me, I would LOVE to have confirmation that I'm doing this properly from someone who knows all the rules regarding this kind of thing. I'd hate to have this come back and bite me in the rump when I think I'm doing everything kosher.
Code: Select all
// my header file
class SourceInfo : public wxClientData, public wxObject
{
public:
DECLARE_DYNAMIC_CLASS(SourceInfo)
// .. vars and junk here
};
Code: Select all
// my cpp file
IMPLEMENT_DYNAMIC_CLASS(SourceInfo,wxObject)
Code: Select all
// attempting to downcast
SourceInfo* inf = wxDynamicCast(mylistbox->GetClientObject(index),SourceInfo);
Thanks in advance!