Discussion:
Using custom pages within wxNotebook
Tim Burgess
2014-07-16 14:37:51 UTC
Permalink
Hi,

I'm successfully adding custom pages to my wxNotebook. These pages are
derived from wxPanel. However, I'm encountering an issue if I add public
methods to the custom panel classes. For instance:

class EWIPatchSetPage: public wxPanel
{
public:
EWIPatchSetPage( wxBookCtrlBase *parent);
~EWIPatchSetPage();

// Allow the label of a button within this panel to be assigned externally
void SetButtonLabel( unsigned int nPatchNumber, std::string strPatchName);
...
};

If I try to call the public method:

...
pEWIPatchSetPage = new EWIPatchSetPage( pNotebook);
...
Notebook->AddPage( pEWIPatchSetPage, wstrEWIPatchSetPageTitle, false);
...
// Set the label for button 15:
pEWIPatchSetPage-> SetButtonLabel ( 10, L"Test");

VS2010 throws an error at compile time:

1>EWIFrame.cpp(84): error C2039: 'SetButtonLabel' : is not a member of
'wxPanel'

This is true, as it isn't a member of wxPanel, but it is a member of
EWIPatchSetPage, which is the class in use.

Can anybody advise, please?

Best wishes.
Tim Burgess
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
'Catalin' via wx-users
2014-07-16 14:51:17 UTC
Permalink
Post by Tim Burgess
class EWIPatchSetPage: public wxPanel
{
EWIPatchSetPage( wxBookCtrlBase *parent);
~EWIPatchSetPage();
// Allow the label of a button within this panel to be assigned externally
void SetButtonLabel( unsigned int nPatchNumber, std::string strPatchName);
...
};
...
pEWIPatchSetPage = new EWIPatchSetPage( pNotebook);
...
Notebook->AddPage( pEWIPatchSetPage, wstrEWIPatchSetPageTitle, false);     
...
pEWIPatchSetPage-> SetButtonLabel ( 10, L"Test");
1>EWIFrame.cpp(84): error C2039: 'SetButtonLabel' : is not a member of
'wxPanel'
This is true, as it isn't a member of wxPanel, but it is a member of
EWIPatchSetPage, which is the class in use.
Can anybody advise, please?
What is the type of pEWIPatchSetPage ?  Did you make sure it is not wxPanel* instead of EWIPatchSetPage* ?

Regards,



C
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Tim Burgess
2014-07-16 15:06:07 UTC
Permalink
OK,

I'm obviously having a very bad week for making dumb mistakes and not
checking properly. Thanks for pointing out the obvious that I missed and
apologies for wasting your time.


Best wishes.
Tim Burgess


-----Original Message-----
From: wx-***@googlegroups.com [mailto:wx-***@googlegroups.com]
Sent: 16 July 2014 15:51
To: wx-***@googlegroups.com
Subject: Re: Using custom pages within wxNotebook
Post by Tim Burgess
class EWIPatchSetPage: public wxPanel
{
EWIPatchSetPage( wxBookCtrlBase *parent); ~EWIPatchSetPage();
// Allow the label of a button within this panel to be assigned
externally void SetButtonLabel( unsigned int nPatchNumber, std::string
strPatchName); ...
};
...
pEWIPatchSetPage = new EWIPatchSetPage( pNotebook); ...
Notebook->AddPage( pEWIPatchSetPage, wstrEWIPatchSetPageTitle, false);
...
pEWIPatchSetPage-> SetButtonLabel ( 10, L"Test");
1>EWIFrame.cpp(84): error C2039: 'SetButtonLabel' : is not a member of
'wxPanel'
This is true, as it isn't a member of wxPanel, but it is a member of
EWIPatchSetPage, which is the class in use.
Can anybody advise, please?
What is the type of pEWIPatchSetPage ?  Did you make sure it is not wxPanel*
instead of EWIPatchSetPage* ?

Regards,



C

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...