wxBookCtrlEvent(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– 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:

  • wxNotebook
  • wxListbook
  • wxChoicebook
  • wxTreebook
  • wxToolbook
  • wxAuiNotebook

This class is derived, and can use functions, from:

  • wxNotifyEvent
  • wxCommandEvent
  • wxEvent

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/1 will return the same value as getOldSelection/1 when called from the EVT_BOOKCTRL_PAGE_CHANGING handler β€” 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