AddPendingEvent() is inaccessible Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

AddPendingEvent() is inaccessible

Post by MoonKid »

After updating my SVN yesterday (it was few month old) I got a error message from my compiler I have never read before.

Code: Select all

mingw32-g++.exe -Wall -DwxUSE_UNICODE  -g -D_DEBUG -D__WXDEBUG__ -DWXUSINGDLL -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH  -Wall   -IC:\wxWidgets\include -Ithird-party\wxSerialize\include\wx -Iinclude -IC:\MinGW\include  -c D:\Garage\projekte\blackfisk\trunk\src\BFMsgObserver.cpp -o .out\objs_debd\src\BFMsgObserver.o
D:\Garage\projekte\blackfisk\trunk\src\BFMsgObserver.cpp: In member function `virtual void BFMsgObserver::ValueChanged(Subject*)':
C:/wxWidgets/include/wx/event.h:2895: error: `virtual void wxEvtHandler::AddPendingEvent(const wxEvent&)' is inaccessible
D:\Garage\projekte\blackfisk\trunk\src\BFMsgObserver.cpp:97: error: within this context
Process terminated with status 1 (0 minutes, 4 seconds)
2 errors, 0 warnings
I don't know what "inaccessible" mean in that context. My compiler never used this word before. ;)

The "context" is

Code: Select all

            wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, BF_BACKUPPROGRESSDLG_QUESTION);
            // message type
            event.SetExtraLong  (pSys->GetLastType());
            // the question
            event.SetString     (strMsg);
            //
            BFBackupProgressDlg::Instance()->GetMutex()->Lock();
            // send event
            BFBackupProgressDlg::Instance()->AddPendingEvent(event);
            // want for answer from main-thread/user
            BFBackupProgressDlg::Instance()->GetCondition()->Wait();
            // get the answer
            stop = BFThread_BackupRunner::CurrentlyRunning()->GetUsersStopAnswer();
But I don't know if it helps.

This is the non-public-missing(!) definition of the class

Code: Select all

class BFBackupProgressDlg : public wxDialog
{
  // ....
Any idea what happened here?
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi,

There have been various changes recently in the event code. One of these was to make wxEvtHandler::AddPendingEvent and wxEvtHandler::ProcessEvent private. Why? Because (according to VZ) if you call them direct, the default handler is called, ignoring any others that may have been pushed. Instead you should access them via wxWindow::GetEventHandler.

So your code should be changed to:
BFBackupProgressDlg::Instance()->GetEventHandler()->AddPendingEvent(event);

Regards,

David
Post Reply