View Source wxProgressDialog (wx v2.4.3)
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).
This class is derived, and can use functions, from:
wxWidgets docs: wxProgressDialog
Summary
Functions
Destroys the object
Equivalent to new(Title, Message, [])
.
Can be used to continue with the dialog, after the user had clicked the "Abort" button.
Equivalent to update(This, Value, [])
.
Updates the dialog, setting the progress bar to the new value and updating the message if new one is specified.
Types
-type wxProgressDialog() :: wx:wx_object().
Functions
-spec destroy(This :: wxProgressDialog()) -> ok.
Destroys the object
-spec new(Title, Message) -> wxProgressDialog() when Title :: unicode:chardata(), Message :: unicode:chardata().
Equivalent to new(Title, Message, [])
.
-spec new(Title, Message, [Option]) -> wxProgressDialog() when Title :: unicode:chardata(), Message :: unicode:chardata(), Option :: {maximum, integer()} | {parent, wxWindow:wxWindow()} | {style, integer()}.
-spec resume(This) -> ok when This :: wxProgressDialog().
Can be used to continue with the dialog, after the user had clicked the "Abort" button.
-spec update(This, Value) -> boolean() when This :: wxProgressDialog(), Value :: integer().
Equivalent to update(This, Value, [])
.
-spec update(This, Value, [Option]) -> boolean() when 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 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.
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.