xrc subclassing problem

Luca Cappa luca.cappa at sequoia.it
Wed Mar 5 10:13:16 PST 2008


Hello,

I am using wxMSW2.8.7, msvc2005 and windows xp, and while running my  
application (statically linked in release configuration to wxWidgets) I am  
getting the message "Subclass 'sqyScrollbar' not found for resource  
ID_SCROLLBAR, not subclassing!".

In particular, I created a xrc file with the following content:

     <object class="wxPanel" name="ID_OSCILLOSCOPETIMESCROLLBAR"  
subclass="OscilloscopeTimeScrollbar">
         <style>wxTAB_TRAVERSAL</style>
.....
         <object class="wxBoxSizer">
             <orient>wxHORIZONTAL</orient>
             <object class="sizeritem">
........
                 <object class="wxScrollBar" name="ID_TIMESB"  
subclass="sqyScrollbar">
                     <style>wxSB_HORIZONTAL|wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE</style>
.........
                 </object>
             </object>
         </object>
     </object>

The sqyScrollbar is a class I written which is based (C++ inheritance) on  
the existing wxScrollBar class.

The problem is that when I build my application as dinamically linked to  
wxWidgets, either in
debug or release configuration I get no error whatsoever related to  
sqyScrollbar, but if I build
a release statically linked, then when in my own code I try to create the  
OscilloscopeTimeScrollbar, I
get a popup windows which reports the error:
"Subclass 'sqyScrollbar' not found for resource ID_SCROLLBAR, not  
subclassing!". Notice that it does not
happen if I build a statically linked application in debug mode!
Has anyone a clue on how to get rid of that popup and of the error? The  
wxScrollbar is effectively not subclassed as I wished, and my sqyScrollbar  
extension is not used at all.

I provide here the definition (inside the sqyscrollbar.cpp) and the  
declaration of the class sqyScrollbar:

#include "sqyscrollbar.h"
IMPLEMENT_DYNAMIC_CLASS (sqyScrollbar, wxScrollBar)
sqyScrollbar::sqyScrollbar (wxWindow *parent, wxWindowID id, const  
wxPoint& pos, const wxSize& size,
                             long style, const wxValidator& validator,  
const wxString& name) :
   wxScrollBar (parent, id, pos, size, style, validator, name) { }
sqyScrollbar::sqyScrollbar () : wxScrollBar () { }

While the sqyscrollbar.h content is:

class WXCOMPONENTS_API sqyScrollbar : public wxScrollBar
{
   DECLARE_DYNAMIC_CLASS (sqyScrollbar)
   sqyScrollbar ();
   sqyScrollbar (wxWindow *parent, wxWindowID id, const wxPoint& pos =  
wxDefaultPosition,
     const wxSize& size = wxDefaultSize, long style = wxSB_HORIZONTAL,  
const wxValidator& validator =
     wxDefaultValidator, const wxString& name = wxScrollBarNameStr);
....
};

Thanks in advance,
Luca




More information about the wx-users mailing list