- wxString obj_name = wxString(GetClassInfo()->GetClassName()) + "_Serialize";
- wxLibrary *lib = wxTheLibraries.LoadLibrary("wxserial");
- WXSERIAL(wxObject) *serial =
- (WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
-
- if (!serial) {
- wxString message;
-
- message.Printf("Can't find the serialization object (%s) for the object %s",
- WXSTRINGCAST obj_name, WXSTRINGCAST GetClassInfo()->GetClassName());
- wxMessageBox(message, "Alert !");
- return;
- }
-
- serial->SetObject(this);
- serial->StoreObject(stream);
+ wxString obj_name = wxString(GetClassInfo()->GetClassName()) + "_Serialize";
+ wxLibrary *lib = wxTheLibraries.LoadLibrary("wxserial");
+
+ if (!lib) {
+ wxLogError(_("Can't load wxSerial dynamic library."));
+ return;
+ }
+ if (!m_serialObj) {
+ m_serialObj = (WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
+
+ if (!m_serialObj) {
+ wxLogError(_("Can't find the serialization object '%s' "
+ "for the object '%s'."),
+ obj_name.c_str(),
+ GetClassInfo()->GetClassName());
+ return;
+ }
+ m_serialObj->SetObject(this);
+ }
+
+ m_serialObj->StoreObject(stream);