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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
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 | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||
|
||
|
@@ -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 | ||
|
There was a problem hiding this comment.
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.