wxWizard and EVT_WIZARD_PAGE_CHANGED

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
forlognao2
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon May 23, 2005 3:39 pm

wxWizard and EVT_WIZARD_PAGE_CHANGED

Post by forlognao2 » Mon May 23, 2005 3:49 pm

Hi,

I try to use wxWizard for the first time and I have a problem. How can I write a function which would be called when EVT_WIZARD_PAGE_CHANGE event occures?

I know that it has such syntax:
EVT_WIZARD_PAGE_CHANGED(id, func)
but I would like to write a function for my class derived from wxWizard (let say MyWizard) which would be invoked - I don't want to give 'id' of some particular object:

I try to write something like this:
void MyWizard::OnPageChanged(wxWizardEvent& event){
//some code for this class
}

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Re: wxWizard and EVT_WIZARD_PAGE_CHANGED

Post by upCASE » Tue May 24, 2005 7:26 am

Hi!
forlognao2 wrote: I know that it has such syntax:
EVT_WIZARD_PAGE_CHANGED(id, func)
but I would like to write a function for my class derived from wxWizard (let say MyWizard) which would be invoked - I don't want to give 'id' of some particular object
Try using wxID_ANY for the id. The function should then be called for all events of this type.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

forlognao2
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon May 23, 2005 3:39 pm

Post by forlognao2 » Tue May 24, 2005 8:09 pm

Thanks, I'll try.

I have another problem :)

I created a class

Code: Select all

class MySpinCtrl : public wxSpinCtrl{
public:
    //...........
    void OnChar(wxKeyEvent& event);
    DECLARE_EVENT_TABLE()
};

//this function is taken from wxWindows 2.4.2 help
void MySpinCtrl::OnChar(wxKeyEvent& event){
    if ( isalpha( event.KeyCode() ) )
    {
       event.Skip();
    }
    else
    {
       wxBell();
    }
}
BEGIN_EVENT_TABLE( MySpinCtrl, wxSpinCtrl )    
    EVT_KEY_DOWN(MySpinCtrl::OnChar)
END_EVENT_TABLE()

It works, I can hear the bell, but text appears on MySpinCtrl anyway. How can I cancel writing on MySpinCtrl if key which was pressed is out of some range (e.g. is a letter, when I want MySpinCtrl to accept only digits)?

Post Reply