wxChoicebook(3erl)
π wxChoicebook (3erl) β the Erlang module, but make it a vibe
okay so bestie, welcome to wxChoicebook π this is the Erlang module definition for the wxChoicebook class, and honestly? it's giving "notebook but with a dropdown". let's get into it π
β¨ NAME β¨
wxChoicebook β literally just the functions for the wxChoicebook class, that's the whole name, periodt π
πΈ DESCRIPTION πΈ
so wxChoicebook is a class that's like wxNotebook, except instead of showing cute little tabs it uses a wxChoice control to show the labels π that's the whole swap, that's the flex.
for the actual usage docs of this class, bestie, please go refer to the base abstract class wxBookCtrl. you can also run page_samples_notebook to see wxChoicebook in action β highly recommend, it's iconic β¨
wxChoicebook allows the use of wxBookCtrlBase::GetControlSizer(), which lets a program add other controls right next to the choice control π«Ά. this is particularly useful when screen space is restricted, as it often is when wxChoicebook is being employed. lowkey the whole reason it exists ngl.
π¦ Styles
this class supports the following styles:
(and yes, that's genuinely the whole list in the original β no styles were listed, so no styles I shall invent π do not come for me)
See: Overview bookctrl, wxNotebook, Examples
this class is derived (and can use functions) from: wxBookCtrlBase, wxControl, wxWindow, wxEvtHandler π§ β the whole ancestry ate, fr fr.
wxWidgets docs: wxChoicebook
π₯ EVENTS π₯
the event types emitted from this class are: choicebook_page_changed, choicebook_page_changing β
π DATA TYPES π
wxChoicebook() = wx:wx_object()β that's it, that's the type, awx_object, slay.
π EXPORTS π
new() -> wxChoicebook()
Constructs a choicebook control π a fresh baby choicebook, no parent, no id, just vibes.
new(Parent, Id) -> wxChoicebook()
Types:
Parent = wxWindow:wxWindow()Id = integer()
new(Parent, Id, Options :: [Option]) -> wxChoicebook()
Types:
Parent = wxWindow:wxWindow()Id = integer()Option ={pos, {X :: integer(), Y :: integer()}} |{size, {W :: integer(), H :: integer()}} |{style, integer()}
addPage(This, Page, Text) -> boolean()
Types:
This = wxChoicebook()Page = wxWindow:wxWindow()Text = unicode:chardata()
addPage(This, Page, Text, Options :: [Option]) -> boolean()
Types:
This = wxChoicebook()Page = wxWindow:wxWindow()Text = unicode:chardata()Option = {bSelect, boolean()} | {imageId, integer()}
adds a new page π iconic behaviour.
the page must have the book control itself as the parent and must not have been added to this control previously β no double-dipping, bestie, we don't do that π
the call to this function will generate the page changing and page changed events if select is true, but not when inserting the very first page (as there is no previous page selection to switch from in this case and so it wouldn't make sense to e.g. veto such event). makes sense, nothing to change from, so nothing to announce π
Return: true if successful, false otherwise.
Remark: do not delete the page β it will be deleted by the book control. it's not yours anymore, you handed it over, the book control is the main character now π
See: insertPage/5
advanceSelection(This) -> ok
Types:
This = wxChoicebook()
advanceSelection(This, Options :: [Option]) -> ok
Types:
This = wxChoicebook()Option = {forward, boolean()}
cycles through the tabs π like flipping through your fyp. note that the call to this function generates the page changing events β‘
assignImageList(This, ImageList) -> ok
Types:
This = wxChoicebook()ImageList = wxImageList:wxImageList()
sets the image list for the page control and takes ownership of the list π«Ά so like, you gave it away, it's the control's problem now.
See: wxImageList, setImageList/2
create(This, Parent, Id) -> boolean()
Types:
This = wxChoicebook()Parent = wxWindow:wxWindow()Id = integer()
create(This, Parent, Id, Options :: [Option]) -> boolean()
Types:
This = wxChoicebook()Parent = wxWindow:wxWindow()Id = integer()Option ={pos, {X :: integer(), Y :: integer()}} |{size, {W :: integer(), H :: integer()}} |{style, integer()}
create the choicebook control that has already been constructed with the default constructor β¨ it's the "you exist but you're not really alive yet" pipeline.
deleteAllPages(This) -> boolean()
Types:
This = wxChoicebook()
deletes all pages π every single one. no survivors.
getCurrentPage(This) -> wxWindow:wxWindow()
Types:
This = wxChoicebook()
returns the currently selected page or NULL π (yes, NULL can happen, it's a whole thing).
getImageList(This) -> wxImageList:wxImageList()
Types:
This = wxChoicebook()
returns the associated image list β may be NULL bestie, so check before you use it, i'm begging.
See: wxImageList, setImageList/2
getPage(This, Page) -> wxWindow:wxWindow()
Types:
This = wxChoicebook()Page = integer()
returns the window at the given page position πͺ
getPageCount(This) -> integer()
Types:
This = wxChoicebook()
returns the number of pages in the control π’ how many we got, fr fr.
getPageImage(This, NPage) -> integer()
Types:
This = wxChoicebook()NPage = integer()
returns the image index for the given page πΌοΈ
getPageText(This, NPage) -> unicode:charlist()
Types:
This = wxChoicebook()NPage = integer()
returns the string for the given page π the label, the text, the whole aesthetic.
getSelection(This) -> integer()
Types:
This = wxChoicebook()
returns the currently selected page, or wxNOT_FOUND if none was selected πΈ
Note: this method may return either the previously or newly selected page when called from theEVT_BOOKCTRL_PAGE_CHANGEDhandler depending on the platform β sowxBookCtrlEvent:getSelection/1should be used instead in this case π don't say I didn't warn you, iykyk.
hitTest(This, Pt) -> Result
Types:
Result = {Res :: integer(), Flags :: integer()}This = wxChoicebook()Pt = {X :: integer(), Y :: integer()}
returns the index of the tab at the specified position, or wxNOT_FOUND if none π―
if flags parameter is non-NULL, the position of the point inside the tab is returned as well π bonus data.
Return: returns the zero-based tab index or wxNOT_FOUND if there is no tab at the specified position.
insertPage(This, Index, Page, Text) -> boolean()
Types:
This = wxChoicebook()Index = integer()Page = wxWindow:wxWindow()Text = unicode:chardata()
insertPage(This, Index, Page, Text, Options :: [Option]) -> boolean()
Types:
This = wxChoicebook()Index = integer()Page = wxWindow:wxWindow()Text = unicode:chardata()Option = {bSelect, boolean()} | {imageId, integer()}
inserts a new page at the specified position π not appending, inserting, we're fancy.
Return: true if successful, false otherwise.
Remark: do not delete the page β it will be deleted by the book control π same rule as before, no take-backsies.
See: addPage/4
setImageList(This, ImageList) -> ok
Types:
This = wxChoicebook()ImageList = wxImageList:wxImageList()
sets the image list to use πΌοΈ
it does not take ownership of the image list β you must delete it yourself. unlike assignImageList/2, this one's still your responsibility bestie, so don't forget π
See: wxImageList, assignImageList/2
setPageSize(This, Size) -> ok
Types:
This = wxChoicebook()Size = {W :: integer(), H :: integer()}
sets the width and height of the pages π
Note: this method is currently not implemented for wxGTK π so on GTK it's giving nothing. it just won't do the thing.
setPageImage(This, Page, Image) -> boolean()
Types:
This = wxChoicebook()Page = Image = integer()
sets the image index for the given page πΌοΈ
image is an index into the image list which was set with setImageList/2 β so it's a pointer-by-number situation, keep track of your indices bestie.
setPageText(This, Page, Text) -> boolean()
Types:
This = wxChoicebook()Page = integer()Text = unicode:chardata()
sets the text for the given page π rename that page, rebrand it, glow-up era.
setSelection(This, Page) -> integer()
Types:
This = wxChoicebook()Page = integer()
sets the selection to the given page, returning the previous selection π
notice that the call to this function generates the page changing events β‘ β use the changeSelection/2 function if you don't want these events to be generated. pick your fighter.
See: getSelection/1
changeSelection(This, Page) -> integer()
Types:
This = wxChoicebook()Page = integer()
changes the selection to the given page, returning the previous selection π
this function behaves as setSelection/2 but does not generate the page changing events π€« silent mode, stealth mode, no notifications.
See overview_events_prog for more information.
destroy(This :: wxChoicebook()) -> ok
Destroys the object ππ that's it, that's the whole function. it's over, it's done, the era has ended.
and that's the whole page bestie, you ate that π«Άβ¨ go forth and choicebook responsibly π
huge kiss to the wxWidgets team for writing this β page came from the wx 2.2.2.1 docs and the original wxChoicebook(3erl) manual page, so credit where credit's due π
π¦ 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