tags:

views:

8

answers:

1

hi sorry for my stupid question

what are the right way to create multiple control object from a list of array of label of object ...?

thank

A: 

The function wxCreateDynamicObject can be used to construct a new object of a given type, by supplying a string name. If you have a pointer to the wxClassInfo object instead, then you can simply call wxClassInfo::CreateObject.

You must include the IMPLEMENT_DYNAMIC_CLASS macro in every class you want to be able to dynamically create objects. IMPLEMENT_DYNAMIC_CLASS is a macro that not only initialises the static wxClassInfo member, but defines a global function capable of creating a dynamic object of the class in question.

Example

In a header file:

class wxFrame : public wxWindow
{
DECLARE_DYNAMIC_CLASS(wxFrame)

private:
    wxString m_title;

public:
    ...
};

In a C++ file:

IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)

wxFrame::wxFrame()
{
...
}
Rui Curado