+A simple example will help understand how the scheme works. Suppose you have
+a XRC file defining a top level window {\tt TestWnd\_Base}, which subclasses {\tt wxFrame} (any
+other class like {\tt wxDialog} will do also), and has subwidgets {\tt wxTextCtrl} A and {\tt wxButton} B.
+The XRC file and corresponding class definition in the header file will be something like:
+
+\begin{verbatim}
+<?xml version="1.0"?>
+<resource version="2.3.0.1">
+ <object class="wxFrame" name="TestWnd_Base">
+ <size>-1,-1</size>
+ <title>Test</title>
+ <object class="wxBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <object class="wxTextCtrl" name="A">
+ <label>Test label</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <object class="wxButton" name="B">
+ <label>Test button</label>
+ </object>
+ </object>
+ </object>
+ </object>
+</resource>
+
+
+class TestWnd_Base : public wxFrame {
+protected:
+ wxTextCtrl* A;
+ wxButton* B;
+
+private:
+ void InitWidgetsFromXRC(){
+ wxXmlResource::Get()->LoadObject(this,NULL,"TestWnd","wxFrame");
+ A = XRCCTRL(*this,"A",wxTextCtrl);
+ B = XRCCTRL(*this,"B",wxButton);
+ }
+public:
+TestWnd::TestWnd(){
+ InitWidgetsFromXRC();
+ }
+};
+\end{verbatim}
+
+The generated window class can be used as basis for the full window class. The
+class members which represent widgets may be accessed by name instead of using
+{\tt XRCCTRL} every time you wish to reference them (note that they are {\tt protected} class members),
+though you must still use {\tt XRCID} to refer to widget ids in the event
+table.
+
+Example:
+
+\begin{verbatim}
+#include "resource.h"
+
+class TestWnd : public TestWnd_Base {
+ public:
+ TestWnd(){
+ // A, B already initialised at this point
+ A->SetValue("Updated in TestWnd::TestWnd");
+ B->SetValue("Nice :)");
+ }
+ void OnBPressed(wxEvent& event){
+ Close();
+ }
+ DECLARE_EVENT_TABLE();
+};
+
+BEGIN_EVENT_TABLE(TestWnd,TestWnd_Base)
+EVT_BUTTON(XRCID("B"),TestWnd::OnBPressed)
+END_EVENT_TABLE()
+
+\end{verbatim}
+
+\subsection{Adding new resource handlers}\label{newresourcehandlers}