Document Connect() limitations compared to Bind()

Instead of just saying that Bind() is better, provide some points
illustrating why is it better.

Notable mention that Connect() can only be used with methods of the
classes publicly inheriting from wxEvtHandler, unlike Bind().

Closes #19266.
This commit is contained in:
Vadim Zeitlin
2021-10-04 00:27:53 +02:00
parent 34989c614d
commit 9b5a72bd1e

View File

@@ -710,7 +710,13 @@ public:
Notice that Bind() provides a more flexible and safer way to do the Notice that Bind() provides a more flexible and safer way to do the
same thing as Connect(), please use it in any new code -- while same thing as Connect(), please use it in any new code -- while
Connect() is not formally deprecated due to its existing widespread Connect() is not formally deprecated due to its existing widespread
usage, it has no advantages compared to Bind(). usage, it has no advantages compared to Bind() and has a number of
drawbacks, including:
- Less compile-time safety.
- Unintuitive parameter order.
- Limited to use with the methods of the classes publicly inheriting
from wxEvtHandler.
This is an alternative to the use of static event tables. It is more This is an alternative to the use of static event tables. It is more
flexible as it allows connecting events generated by some object to an flexible as it allows connecting events generated by some object to an