RE: Problem loading .xrc file

<[email protected]> Thu, 21 Aug 2025 10:16:13 +0100
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
OK, got it.

Many thanks for the clarification.

All the best.

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/

-- 
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/03ee01dc127c%243dbfb1d0%24b93f1570%24%40gmail.com.