RE: Problem loading .xrc file
"Tim Burgess" <[email protected]> Tue, 26 Aug 2025 14:30:51 +0100
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, I now have this solved - thanks. However, I have another issue based around my lack of understanding of how the cusclass.* files work with the XRC demo. In cusclass.xrc there is: <object class="unknown" name="custom_control_placeholder"> I understand that this is to provide a space where an object of a custom class can be inserted. What I don't understand is how the c++ code decides to insert a particular custom class into this space, as nothing in the c++ code references either "unknown" or " custom_control_placeholder ". In my own code I have custom classes derived from wxPane for each page of a wxNotebook and the cusclass example requires me to: 1 - Insert something like: wxDECLARE_DYNAMIC_CLASS(Page1Class); into the top of each of my custom class definitions. 2 - Insert lines like: wxIMPLEMENT_DYNAMIC_CLASS(Page1Class, wxPanel); for each of my custom classes. 3 - Modify the constructors of each of my custom classes to reflect the default constructor for wxPane. I suppose I could just about accept that all of this within cusclass performs some sort of magic to bind any object with a class "unknown" to the provided MyResizableListCtrl class, but that wouldn't provide a mechanism to handle multiple custom classes. I know I'm missing something, but just can't spot it. Help! Tim -----Original Message----- From: [email protected] <[email protected]> On Behalf Of Vadim Zeitlin Sent: 20 August 2025 15:56 To: [email protected] Subject: Re: Problem loading .xrc file On Wed, 20 Aug 2025 09:11:50 +0100 Tim Burgess wrote: TB> I've been taking inspiration from the XRC sample, particularly the TB> code for derived classes, but get the following: TB> TB> TB> TB> wxWidgets Debug Alert TB> TB> A debugging check in this application has failed. TB> TB> C:\Users\Tim\p\wxWidgets\src\msw\window.cpp(1293): assert "!m_oldWndProc" TB> failed in wxWindow::SubclassWin(): subclassing window twice? TB> TB> TB> TB> When my code executes: TB> TB> TB> TB> wxXmlResource::Get()->LoadDialog(this, parent, "myDlg"); TB> TB> TB> TB> within the constructor of my derived dialog. You need to use the default constructor when using LoadDialog(), as it creates the window. You must be using the non-default wxDialog ctor which also does it — resulting in the window being created twice. Assert should ideally be more clear, but I'm not sure if it can't happen in other situations, which would make it misleading to say that it's due to creating the window twice. Regards, VZ -- TT-Solutions: wxWidgets consultancy and technical support https://www.tt-solutions.com/ which provides a space to insert an object of a custom class. However, I don't see "unknown" or "" -- Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. --- You received this message because you are subscribed to the Google Groups "wx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/wx-users/01b101dc168d%24a4dbcba0%24ee9362e0%24%40raisedbar.net.