Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / EVENT_TABLE

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. EVENT_TABLE
#2866
Posted by: 2003-11-07 22:45:04
hello,

i have a program to edit, not built by myself.
It had a main screen and different Dialogs (modal)

Those who buildt the programm made 1 event table in the main class. and all the eventhandlers (for all dialogs) in the Gui class.

All the dialogs have their own class, i want to move the eventhandlers to be members of the classes they handle events for.

While keeping the 1 event table in main, i could move the event handlers to their respective classes, but i had to make them public for else they could not be accesed from the event table.

So now i also want to split up the event table and have different event tables within each of the dialog classes.
I entered DECLARE_EVENT_TABLE in the header of the dialog classes and split up the event table by creating new event tables in the implementation of their respective classes.

Now i get the following error at the line BEGIN_EVENT_TABLE:

error C2248: 'sm_eventTable' : cannot access protected member declared in class 'wxFrame'


Can anyone please help me with this problem? if needed, for extra information i copy pasted some relevant parts of my code here, possibly you don't need, but i rather give too much info than too little:

//this is the part where i get the error, It is in file UI.cpp, UI.cpp contains all the class implementations for the dialogs:

BEGIN_EVENT_TABLE(cCodecDialog, wxFrame)                     <-------ERROR
   EVT_BUTTON(OKCodecDlgBTN, cCodecDialog::OnOkClicked)
   EVT_BUTTON(CancelCodecDlgBTN,  cCodecDialog::OnCanClicked)
   EVT_BUTTON(PrevCodecDlgBTN, cCodecDialog::OnPrevClicked)
END_EVENT_TABLE()

//i have the eventhandlers right below this event table:

void cCodecDialog::OnOkClicked(wxCommandEvent& Event)
{
  gUI->CodecDialog->EndModal(OKCodecDlgBTN);
}

//The Button Identifiers are declared in UI.h

enum
{
  OKCodecDlgBTN,
  CancelCodecDlgBTN,
  PrevCodecDlgBTN,
};

//this is in the class declaration in UI.h:

class cCodecDialog : public wxDialog
{
public:
   void OnOkClicked(wxCommandEvent& event);
   void OnCanClicked(wxCommandEvent& event);
   void OnPrevClicked(wxCommandEvent& event);
private:
   wxButton *OKButton, *CancelButton, *PreviousButton
DECLARE_EVENT_TABLE()
}

Message2. Re: EVENT_TABLE
#2867
Posted by: 2003-11-07 23:53:41
In your event table, you still have wxFrame as your parent, where it should be wxDialog.

Also, in the text here:
wxButton *OKButton, *CancelButton, *PreviousButton
is missing the ;
Message3. Re: EVENT_TABLE
#2870
Posted by: 2003-11-08 15:40:14
Thank you !

I always feel so stupid after needing a forum for such a stupid mistakes :)

(not the ; that is just a copy paste error when getting code in the post)
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0