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

Update documentation to reflect recent Bind() changes #362

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 29 additions & 2 deletions docs/doxygen/overviews/eventhandling.h
Expand Up @@ -242,7 +242,7 @@ Now let us describe the semantic differences:

<li>
As a slight extension of the above, the handlers can also be unbound at
any time with Unbind<>() (and maybe rebound later). Of course,
any time with Unbind<>() (and may be rebound later). Of course,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the meaning slightly. Originally it was meant to say that the handlers could, perhaps, be re-bound later if needed. I'm not sure if the new wording really makes it more clear.

it's also possible to emulate this behaviour with the classic
static (i.e., bound via event tables) handlers by using an internal
flag indicating whether the handler is currently enabled and returning
Expand Down Expand Up @@ -349,6 +349,33 @@ MyFrame::MyFrame()
}
@endcode

You can also bind functions that are members of any class provided that the
class publicly derives from wxTrackable from somewhere down the line and that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part seems just wrong to me, you can bind methods of any class, full stop. Why does it have to derive from wxTrackable?

you have a pointer to that class object.
For example:

@code
class MyFrame : public wxFrame
{
private:
void OnExit(wxCloseEvent& event);
}

void MyFrame::OnExit(wxCloseEvent& event)
{
// ...
}

MyFrame::MyFrame()
{
Bind(wxEVT_CLOSE_WINDOW, &MyFrame::OnExit, this);
}
@endcode

You can also bind functions for classes that don't publicly derive from wxTrackable
somewhere down the line, provided that your compiler supports C++11.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this seems wrong to me (and very confusing even if it were true, you can't say "you can only do this if that" only to add later "but you can also do this even if not that, sometimes").

Do note that in such cases event propagation will @b not work).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is absolutely not clear and, to repeat for the N-th time, I'm not sure if it's correct neither. What exactly does this mean? What exactly doesn't work?


And finally you can bind to an arbitrary functor and use it as an event
handler:

Expand Down Expand Up @@ -411,7 +438,7 @@ MyFrame::MyFrame()
@endcode


With the aid of @c bind<>() you can even use methods or functions which
With the aid of @c Bind<>() you can even use methods or functions which
don't quite have the correct signature:

@code
Expand Down