wxMSW2.8.3 - 'OnOK' : is not a member of 'wxDialog' ??

Carsten A. Arnholm arnholm at offline.no
Tue Apr 17 13:45:33 PDT 2007


Hello,

I have a setup on Win XP using Code::Blocks IDE & MS VC++ 2005 Express. I 
have been able to make some things that work just fine on XP and Kubuntu, 
but I now struggle with some basic problems that I do not understand.

I am trying to make a "Settings" dialog for my app

class Settings: public wxDialog {
  ....
};

The Settings dialog contains a wxNotebook with one page and suitable sizers. 
The dialog also contains a wxStdDialogButtonSizer with and OK and Cancel 
button.

What I am trying to do, is to catch the wxID_OK event in my dialog and 
handle some of the data settings, and then call wxDialog::OnOK(..) to close 
the dialog

void Settings::OnOK(wxCommandEvent& event)
{
    // handle things here

    wxDialog::OnOK(event);
}

In the Settings class constructor I have
Connect(wxID_OK,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&Settings::OnOK);


When I compile the code, I get this error message:
settings.cpp(84) : error C2039: 'OnOK' : is not a member of 'wxDialog'

I do not understand why I get this message, OnOK(wxCommandEvent& event) is 
clearly a member function of 'wxDialog' ? I have checked it several times. 
If I remove the call to  wxDialog::OnOK(event); it compiles, and I can break 
in the Settings::OnOK function, but obviously the dialog does not close.

Maybe the questions are

a) Why do I get the error when calling wxDialog::OnOK(event); ?
b) Have I misunderstood how to handle the OnOK event for a custom dialog?

Any help most welcome!

-- 
Carsten A. Arnholm
http://arnholm.org/
N59.776 E10.457 








More information about the wx-users mailing list