wxProgressDialog(3erl)

🎀 NAME 🎀

okay so this is wxProgressDialog(3erl) — the Erlang module definition page, manual name folded in right here at the top like a little name tag 🎀. wxProgressDialog — Functions for the wxProgressDialog class, bestie. That’s the NAME section doing exactly what it says on the tin 💅.

✨ DESCRIPTION ✨

Here’s the vibe: if supported by the platform, this class will provide the platform’s native progress dialog, else it will simply be the wxGenericProgressDialog (not implemented in wx) 😭. That’s the fallback tea, no cap.

This class is derived (and can use functions) from: wxDialog wxTopLevelWindow wxWindow wxEvtHandler — a whole iconic little inheritance chain 👑.

wxWidgets docs: wxProgressDialog — that’s the pointer, iykyk 📚.

🧚 DATA TYPES 🧚

wxProgressDialog() = wx:wx_object() — that’s the type, periodt 🫶.

📤 EXPORTS 📤

Every export is here, all the types, all the options, no skipping the “boring” parts — we don’t do that here 💖.

new(Title, Message) -> wxProgressDialog()

Types:

Title = Message = unicode:chardata()

Two-arg new — Title and Message are both unicode:chardata(), slay ✨.

new(Title, Message, Options :: [Option]) -> wxProgressDialog()

Types:

Title = Message = unicode:chardata()
Option =
    {maximum, integer()} |
    {parent, wxWindow:wxWindow()} |
    {style, integer()}

Three-arg new with the Options :: [Option] list, and the options are exactly these: maximum, parent, and style 💅.

resume(This) -> ok

Types:

This = wxProgressDialog()

So resume is the “we’re so back” function: it can be used to continue with the dialog after the user had clicked the "Abort" button 🫶.

update(This, Value) -> boolean()

Types:

This = wxProgressDialog()
Value = integer()

Two-arg update — types below, no extra prose attached in the source 🌸.

update(This, Value, Options :: [Option]) -> boolean()

Types:

This = wxProgressDialog()
Value = integer()
Option = {newmsg, unicode:chardata()}

Updates the dialog, setting the progress bar to the new value and updating the message if new one is specified ✨.

Returns true unless the "Cancel" button has been pressed. If false is returned, the application can either immediately destroy the dialog or ask the user for the confirmation and if the abort is not confirmed the dialog may be resumed with the resume/1 function.

If value is the maximum value for the dialog, the behaviour of the function depends on whether wxPD_AUTO_HIDE was used when the dialog was created. If it was, the dialog is hidden and the function returns immediately. If it was not, the dialog becomes a modal dialog and waits for the user to dismiss it, meaning that this function does not return until this happens. That’s the whole tea ☕.

Notice that if newmsg is longer than the currently shown message, the dialog will be automatically made wider to account for it. However if the new message is shorter than the previous one, the dialog doesn’t shrink back to avoid constant resizes if the message is changed often. To do this and fit the dialog to its current contents you may call wxWindow:fit/1 explicitly. However the native MSW implementation of this class does make the dialog shorter if the new text has fewer lines of text than the old one, so it is recommended to keep the number of lines of text constant in order to avoid jarring dialog size changes. You may also want to make the initial message, specified when creating the dialog, wide enough to avoid having to resize the dialog later, e.g. by appending a long string of unbreakable spaces (wxString (not implemented in wx)(L'\u00a0', 100)) to it.

destroy(This :: wxProgressDialog()) -> ok

Destroys the object — bye-bye, little dialog icon 🫶.


Big slay to the wxWidgets team 💖 — this is the wx 2.2.2.1 source/version, on the wxProgressDialog(3erl) page, and that’s the cute footer sign-off (no extra date line to report, bestie). Byeee! 🫶✨

📦 where this page comes from