Improve documentation of events sent by wxTreeCtrl::EditLabel()

Make it clear that wxEVT_TREE_END_LABEL_EDIT is sent whether the user
accepts or cancels editing the label.

See #22867.

(cherry picked from commit 6e940d1a108bbf4a07586d32f0d8061beb63f927)
This commit is contained in:
Vadim Zeitlin 2022-12-05 23:35:31 +01:00
parent 1450e5e158
commit b2c37a7e7f

View File

@ -349,13 +349,23 @@ public:
virtual void DeleteChildren(const wxTreeItemId& item);
/**
Starts editing the label of the given @a item. This function generates a
@c EVT_TREE_BEGIN_LABEL_EDIT event which can be vetoed so that no text
control will appear for in-place editing.
Starts editing the label of the given @a item.
If the user changed the label (i.e. s/he does not press ESC or leave the
text control without changes, a @c EVT_TREE_END_LABEL_EDIT event will be
sent which can be vetoed as well.
This function generates a @c EVT_TREE_BEGIN_LABEL_EDIT event which can
be vetoed to prevent the editing from starting.
If it does start, a text control, which can be retrieved using
GetEditControl(), allowing the user to edit the label interactively is
shown. In wxMSW, this text control is created using @a textCtrlClass,
however this parameter is currently ignored in the other ports where a
plain wxTextCtrl is always used.
When the editing ends, @c EVT_TREE_END_LABEL_EDIT event is sent and
this event can be vetoed as well to prevent the label from changing.
Note that this event is sent both when the user accepts (e.g. by
pressing Enter) or cancels (e.g. by pressing Escape) and its handler
can use wxTreeEvent::IsEditCancelled() to distinguish between these
situations.
@see EndEditLabel(), wxTreeEvent
*/