wxBookCtrlEvent(3)
π wxBookCtrlEvent π
okay bestie, this is an Erlang module definition page for wxBookCtrlEvent β the class that represents all the events your book controls throw at you. think wxNotebook, wxListbook, wxChoicebook, wxTreebook, wxAuiNotebook. yeah. all of them. it's giving group chat with five admins π
β¨ DESCRIPTION β¨
PAGE_CHANGING events? they get sent BEFORE the current page actually changes. so the program gets to peek at the current page before anything moves β grab it with getOldSelection/1 β and honestly it can straight up veto the whole page change by calling wxNotifyEvent:veto/1. like, if the values in the controls of the old page are invalid? bye, no page change for you. π
PAGE_CHANGED events are the after-party. they're sent AFTER the page has already changed, and the program cannot veto it any more β it's purely a heads-up that the page changed. no take-backsies, periodt. π
so to summarize, fr fr: if the program cares about validating page values before letting the user switch pages, it should process the PAGE_CHANGING event. otherwise PAGE_CHANGED is probably enough. and in any case? it's probably unnecessary to process both events at once. pick a lane bestie π
See:
wxNotebookwxListbookwxChoicebookwxTreebookwxToolbookwxAuiNotebook
This class is derived, and can use functions, from:
wxNotifyEventwxCommandEventwxEvent
wxWidgets docs: wxBookCtrlEvent
πΈ DATA TYPES πΈ
wxBookCtrl() :: #wxBookCtrl{}.wxBookCtrlEvent() :: wx:wx_object().wxBookCtrlEventType() :: command_notebook_page_changed | command_notebook_page_changing | choicebook_page_changed | choicebook_page_changing | treebook_page_changed | treebook_page_changing | toolbook_page_changed | toolbook_page_changing | listbook_page_changed | listbook_page_changing.
π¦ FUNCTIONS π¦
getOldSelection(This) -> integer() when This :: wxBookCtrlEvent().
returns the page that was selected before the change. and if none was selected? you get wxNOT_FOUND. iconic behavior honestly π«Ά
getSelection(This) -> integer() when This :: wxBookCtrlEvent().
returns the currently selected page, or wxNOT_FOUND if none was selected. same energy as above, just the now version.
Note: under Windows,getSelection/1will return the same value asgetOldSelection/1when called from theEVT_BOOKCTRL_PAGE_CHANGINGhandler β and not the page which is going to be selected. so if you're on Windows and you're squinting at this like "why are these the same number", that's why bestie π not a bug, just Windows being Windows π
setOldSelection(This, Page) -> ok when This :: wxBookCtrlEvent(), Page :: integer().
sets the id of the page selected before the change. setting that history, lowkey π
setSelection(This, Page) -> ok when This :: wxBookCtrlEvent(), Page :: integer().
sets the selection member variable. that's it, that's the whole vibe β¨
okay so that's the whole page β every flag, every type, every note, nothing skipped, no cap π§ go forth and validate your pages before you let anybody switch tabs, and if you're on Windows, remember the little getSelection/1 gotcha, iykyk π
this whole thing came from Ericsson AB, version wx 2.6, and yeah, slay ππ
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms