Author Topic: wxSmith adds the event handler, but the connection is lost immediately  (Read 28 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
I see some strange issue about using wxSmith to add some event handler.

Suppose I have a wxButton on the GUI designer, and when I go to the left navigation panel of the wxSmith, to add a new event handler.

It looks like the event handler function is added to the associated header files and implementation file, that's good, but I soon noticed that the connection between the gui control and the event handler is lost.

What I need to do is the use the mouse to click on other wxSmith control again, and click back on the previous control again, and in the wxSmith's Events panel, I have to open the list box of the event functions, and select the one I recently added. By doing this, the actual connection between the gui control and event handler is generated, and I see there is a function call statement like:

Code
Connect(ID_CHECKBOX1, wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&MyDialog::OnCheckBoxClick);

is added.

My question is: do you see the same issue here? I mean why I need some extra steps to bind the control and event handler? It should bind in the first step when I add the event handler.

Thanks.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.