wxFontPickerCtrl(3)
π wxFontPickerCtrl π
okay bestie, so this is the Erlang module definition for wxFontPickerCtrl, straight out of the wx 2.6 docs, and it's literally the control that lets your user pick a font. yes, like, actually pick one. iconic behaviour, no notes. π
β¨ NAME β¨
wxFontPickerCtrl β this control allows the user to select a font. that's it, that's the whole job, and it does it gorgeously π
πΈ DESCRIPTION πΈ
so the generic implementation is just a button, right? you click it, it brings up a wxFontDialog, done. and native implementations may differ β lowkey they're usually a (small) widget that gives you access to the font-chooser dialog. main character energy but make it smol. π¦
β οΈ real talk though: this whole thing is only available ifwxUSE_FONTPICKERCTRLis set to1(which is the default, so you're probably fine, but likeβ¦ now you know, iykyk).
π¨ Styles
this class supports the following styles, and you're gonna want to know all of them:
wxFNTP_DEFAULT_STYLEβ the default style, which is literallywxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL. the blueprint. the moment. β¨wxFNTP_USE_TEXTCTRLβ creates a text control to the left of the picker button, and that text control is completely managed by thewxFontPickerCtrl, and the user can use it to specify a font (seeSetSelectedFont). the text control is automatically synchronized with the button's value. want to mess with the text control? use functions defined inwxPickerBase. π«ΆwxFNTP_FONTDESC_AS_LABELβ keeps the label of the button updated with the fontface name and the font size. like, for example, choosing"Times New Roman bold, italic with size 10"from the fontdialog will update the label (overwriting any previous label, so don't get attached π) with the"Times New Roman, 10"text.wxFNTP_USEFONT_FOR_LABELβ uses the currently selected font to draw the label of the button. cute AND functional.
See:
wxFontDialogwxFontPickerEvent
This class is derived, and can use functions, from:
wxPickerBasewxControlwxWindowwxEvtHandler
wxWidgets docs: wxFontPickerCtrl
π Events
event types emitted from this class, bestie, listen up:
command_fontpicker_changed
𧬠DATA TYPES π§¬
wxFontPickerCtrl() :: wx:wx_object().
π FUNCTIONS π
create(This, Parent, Id, [Option]) -> boolean()
create(This, Parent, Id, [Option]) -> boolean()
when
This :: wxFontPickerCtrl(),
Parent :: wxWindow:wxWindow(),
Id :: integer(),
Option ::
{initial, wxFont:wxFont()} |
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()} |
{validator, wx:wx_object()}.
creates this widget with the given parameters. slay.
Return: true if the control was successfully created, or false if creation failed. we love an honest boolean. π
destroy(This :: wxFontPickerCtrl()) -> ok.
destroys the object. it's giving closure. rest in peace little widget ποΈ
getMaxPointSize(This) -> integer() when This :: wxFontPickerCtrl().
returns the maximum point size value allowed for the user-chosen font. the ceiling. the limit. the boundary. β
getSelectedFont(This) -> wxFont:wxFont()
getSelectedFont(This) -> wxFont:wxFont()
when This :: wxFontPickerCtrl().
returns the currently selected font.
π note that this function is completely different from wxWindow:getFont/1. like, do not confuse them, they are not the same girl, okay?
new() -> wxFontPickerCtrl().
no args, no notes. a whole new object, just vibes. β¨
new(Parent, Id, [Option]) -> wxFontPickerCtrl()
new(Parent, Id, [Option]) -> wxFontPickerCtrl()
when
Parent :: wxWindow:wxWindow(),
Id :: integer(),
Option ::
{initial, wxFont:wxFont()} |
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()} |
{validator, wx:wx_object()}.
initializes the object and calls create/4 with all the parameters. it's basically the pregame before the actual function shows up. π
setMaxPointSize(This, Max) -> ok
setMaxPointSize(This, Max) -> ok
when
This :: wxFontPickerCtrl(),
Max :: integer().
sets the maximum point size value allowed for the user-chosen font.
the default value is 100. and okay, listen, this part is important: big fonts can require a lot of memory and CPU time, both for creation and for rendering. so β specially because the user has the option to specify the fontsize through a text control (see wxFNTP_USE_TEXTCTRL) β it's a good idea to put a limit to the maximum font size when huge fonts do not make much sense. like, protect your machine, bestie ππ¨
setSelectedFont(This, Font) -> ok
setSelectedFont(This, Font) -> ok
when
This :: wxFontPickerCtrl(),
Font :: wxFont:wxFont().
sets the currently selected font.
π and again, for the people in the back: this function is completely different from wxWindow:setFont/2. two different functions, two different jobs, do not mix them up ngl.
and that's the whole page!! π huge thanks to Ericsson AB for shipping this with wx 2.6 β go forth and pick fonts, you gorgeous genius π¦πβ¨
π¦ 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