wxBookCtrlBase(3erl)
π wxBookCtrlBase β the Erlang module definition, but make it cute π
okay so this is the wxBookCtrlBase page from the Erlang module docs (it lives in the wx application, and the whole thing is basically a wrapper around the wxWidgets class of the same name). Come sit with me, bestie, we're gonna go through the whole thing π
β¨ NAME β¨
wxBookCtrlBase β functions for the wxBookCtrlBase class. That's it, that's the name, we love a straightforward icon π
πΈ DESCRIPTION πΈ
A book control is genuinely one of the nicest ways to show multiple pages of information β you display one page at a time, like a lil book, hence the name, no cap πβ¨
wxWidgets has five variants of this control.
This abstract class is the parent of all of those book controls, and it's the one that hands them their basic interface. Heads up though: it's a pure virtual class, so you literally cannot allocate it directly, no matter how much you want to π it's giving "look but don't touch" energy.
See: Overview bookctrl
This class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler β three ancestors, three icons, all in the family tree π
wxWidgets docs: wxBookCtrlBase
π¦ DATA TYPES π¦
wxBookCtrlBase() = wx:wx_object()
that's the whole type section, short and sweet, we stan a minimal queen π
π₯ EXPORTS π₯
addPage(This, Page, Text) -> boolean()
Types
This = wxBookCtrlBase()
Page = wxWindow:wxWindow()
Text = unicode:chardata()
addPage(This, Page, Text, Options :: [Option]) -> boolean()
Types
This = wxBookCtrlBase()
Page = wxWindow:wxWindow()
Text = unicode:chardata()
Option = {bSelect, boolean()} | {imageId, integer()}
Adds a new page. New page, who dis π«
The page must have the book control itself as the parent, and it must not have been added to this control previously. No recycling pages, bestie, that's the rule π«
The call to this function will generate the page changing and page changed events if select is true β but not when you're inserting the very first page. Why? Because there's no previous page selection to switch from in that case, so it wouldn't make sense to e.g. veto such an event. Logic! We love her π§ β¨
Return: true if successful, false otherwise.
Remark: Do not delete the page β it will be deleted by the book control. The control called dibs. It's her page now π
See: insertPage/5
insertPage(This, Index, Page, Text) -> boolean()
Types
This = wxBookCtrlBase()
Index = integer()
Page = wxWindow:wxWindow()
Text = unicode:chardata()
insertPage(This, Index, Page, Text, Options :: [Option]) -> boolean()
Types
This = wxBookCtrlBase()
Index = integer()
Page = wxWindow:wxWindow()
Text = unicode:chardata()
Option = {bSelect, boolean()} | {imageId, integer()}
Inserts a new page at the specified position β yes you can slide it in wherever, main character placement privileges π
Return: true if successful, false otherwise.
Remark: Do not delete the page, it will be deleted by the book control. Same deal as before, hands off π
See: addPage/4
deletePage(This, Page) -> boolean()
Types
This = wxBookCtrlBase()
Page = integer()
Deletes the specified page, and the associated window. It's gone gone π«‘
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 not send any events when deleting the last page. Why? Because in that case the selection also changes, sure, but it becomes invalid, and for compatibility reasons the control never generates events with the invalid selection index. Compatibility is that girl, she's not budging π
removePage(This, Page) -> boolean()
Types
This = wxBookCtrlBase()
Page = integer()
Deletes the specified page, without deleting the associated window. So the page leaves the book but the window lives on β survivor energy π
See deletePage/2 for a note about the events generated by this function. Same event drama, different page fate.
deleteAllPages(This) -> boolean()
Types
This = wxBookCtrlBase()
Deletes all pages. All of them. Every single one. Clean slate, fresh start, new era β¨
getPage(This, Page) -> wxWindow:wxWindow()
Types
This = wxBookCtrlBase()
Page = integer()
Returns the window at the given page position. Lil lookup, no drama π
getPageCount(This) -> integer()
Types
This = wxBookCtrlBase()
Returns the number of pages in the control. Counting is self care bestie π’π
getCurrentPage(This) -> wxWindow:wxWindow()
Types
This = wxBookCtrlBase()
Returns the currently selected page, or NULL. If nobody's selected, you get NULL and you just have to deal with that π«
advanceSelection(This) -> ok
Types
This = wxBookCtrlBase()
advanceSelection(This, Options :: [Option]) -> ok
Types
This = wxBookCtrlBase()
Option = {forward, boolean()}
Cycles through the tabs. Round and round and round we go π
The call to this function generates the page changing events. Events! Always with the events!
setSelection(This, Page) -> integer()
Types
This = wxBookCtrlBase()
Page = integer()
Sets the selection to the given page, returning the previous selection. Bye previous selection, you had a good run π
Notice that the call to this function generates the page changing events. If you do not want those events to be generated, use the changeSelection/2 function instead. Choose your fighter π₯
See: getSelection/1
getSelection(This) -> integer()
Types
This = wxBookCtrlBase()
Returns the currently selected page, or wxNOT_FOUND if none was selected. The classic "she's not here right now" response π
Important-ish note: this method may return either the previously selected page or the newly selected page when called from theEVT_BOOKCTRL_PAGE_CHANGEDhandler β it depends on the platform. So in that case you should usewxBookCtrlEvent:getSelection/1instead. Platform-dependent behaviour, my beloved chaotic queen π
changeSelection(This, Page) -> integer()
Types
This = wxBookCtrlBase()
Page = integer()
Changes the selection to the given page, returning the previous selection.
This function behaves exactly like setSelection/2 but β plot twist β does not generate the page changing events. Quiet mode activated π€«
See overview_events_prog for more information.
hitTest(This, Pt) -> Result
Types
Result = {Res :: integer(), Flags :: integer()}
This = wxBookCtrlBase()
Pt = {X :: integer(), Y :: integer()}
Returns the index of the tab at the specified position, or wxNOT_FOUND if none. Point at a tab, find out what tab it is, extremely detective of you πβ¨
If the flags parameter is non-NULL, the position of the point inside the tab is returned as well. Bonus info, at no extra cost, we love a two-for-one π
Return: returns the zero-based tab index, or wxNOT_FOUND if there is no tab at the specified position.
getPageText(This, NPage) -> unicode:charlist()
Types
This = wxBookCtrlBase()
NPage = integer()
Returns the string for the given page. Just the text, the label, the vibe π·οΈ
setPageText(This, Page, Text) -> boolean()
Types
This = wxBookCtrlBase()
Page = integer()
Text = unicode:chardata()
Sets the text for the given page. Rename her, rebrand her, she's got a new label now π
and that's the whole page, bestie β every option, every type, every remark, nothing skipped, periodt π«Ά
This cute lil rewrite is brought to you by the wxWidgets team, version wx 2.2.2.1 β original page was wxBookCtrlBase(3erl), and now it's this. Slay, go build something iconic ππ
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms