However sometimes doing it is too difficult or maybe even impossible if you are using third-party libraries and in this case wxBusyInfo provides a very simple way to at least indicate that the program is busy, using it is as easy as creating an object on the stack:
wxBusyInfo wait("Working, please wait...", parent);
Unfortunately, traditionally, it was not just very simple, but very ugly as well, as can be seen on this screenshot:
After the recent changes, you can show to the user something more presentable (especially if you use a decent icon):
and with only slightly more effort:
wxBusyInfo info
(
wxBusyInfoFlags()
.Parent(parent)
.Icon(wxArtProvider::GetIcon(wxART_PRINT))
.Title("<b>Printing your document</b>")
.Text("Please wait...")
.Foreground(*wxWHITE)
.Background(*wxBLACK)
.Transparency(4*wxALPHA_OPAQUE/5)
);
As you can see, now it's possible to specify quite a few more attributes than just the unadorned message:
- There can be an optional icon in the top part of the window.
- Message is now split in the "text" and "title" parts, with the latter shown in bigger font by default.
- Both text and title can contain markup.
- Background and foreground colours can be specified.
- Finally, the window can be made partly transparent.
So while the initial advice to avoid the use of wxBusyInfo in the first place remains valid, you can at least make it less ugly now if you do have to use it.
No comments:
Post a Comment