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 the EVT_BOOKCTRL_PAGE_CHANGED handler β€” it depends on the platform. So in that case you should use wxBookCtrlEvent:getSelection/1 instead. 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