Document wxBookCtrl not sending events when deleting last page

Currently, DeletePage() and RemovePage() functions don't send any events
when deleting the last page of the control and while this is
inconsistent with the behaviour when deleting the other pages, it seems
too dangerous to change this now, as the existing application code might
not expect getting page change events with the invalid page index.

So just document the current behaviour.

Ideal would be to add a unit test checking that this is really the case
under all platforms, for now it was just checked manually under MSW and
GTK.

Closes https://github.com/wxWidgets/wxWidgets/pull/1848
This commit is contained in:
Vadim Zeitlin
2020-05-21 02:03:32 +02:00
parent 04322fa711
commit d83478e94d

View File

@@ -279,7 +279,13 @@ public:
/**
Deletes the specified page, and the associated window.
The call to this function generates the page changing events.
The call to this function generates the page changing events when
deleting the currently selected page or a page preceding it in the
index order, but it does @e not send any events when deleting the last
page: while in this case the selection also changes, it becomes invalid
and for compatibility reasons the control never generates events with
the invalid selection index.
*/
virtual bool DeletePage(size_t page);
@@ -311,6 +317,9 @@ public:
/**
Deletes the specified page, without deleting the associated window.
See DeletePage() for a note about the events generated by this
function.
*/
virtual bool RemovePage(size_t page);