Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change examples to use specialized wx event macros and individual event handling functions #5

Open
saulrh opened this issue Feb 1, 2013 · 1 comment

Comments

@saulrh
Copy link
Collaborator

saulrh commented Feb 1, 2013

Currently, most of the examples use a single EVT_COMMAND set to handle wxID_ANY by dispatching it to a general OnButton with a switch that dispatches to the correct button. This is cumbersome and big switch statements are annoying. Instead, we should be using EVT_BUTTON to create the event table and individual handlers directly connected to the event IDs, like so:

enum TabEventIDs {
id_button_action1 = wxID_HIGHEST+1
};
BEGIN_EVENT_TABLE(Tab, wxPanel)
EVT_BUTTON(id_button_action1, Tab::OnAction1)
END_EVENT_TABLE()
void Tab::OnAction1(wxCommandEvent& evt) { }

@tobiaskunz
Copy link
Contributor

I totally agree. The way it is done currently is a mess. I am currently doing that for the planningTab as part of an overall clean-up of that example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants