wxbusyinfothis class makes it easy to tell your user that the program is temporarily busy. just create a wxbusyinfo object on the stack, and within the current scope, a message window will be shown. for example:
wxbusyinfo wait("please wait, working...");
for (int i = 0; i < 100000; i++)
{
doacalculation();
}
it works by creating a window in the constructor,
and deleting it in the destructor.you may also want to call wxtheapp->yield() to refresh the window periodically (in case it had been obscured by other windows, for example) like this:
wxwindowdisabler disableall;
wxbusyinfo wait("please wait, working...");
for (int i = 0; i < 100000; i++)
{
doacalculation();
if ( !(i % 1000) )
wxtheapp->yield();
}
but take care to not cause undesirable reentrancies when doing it (see
wxapp::yield() for more details). the simplest way to do
it is to use wxwindowdisabler class as illustrated
in the above example.derived from none include files <wx/busyinfo.h> members
wxbusyinfo::wxbusyinfo
wxbusyinfo::wxbusyinfowxbusyinfo(const wxstring& msg, wxwindow* parent = null) constructs a busy info window as child of parent and displays msg in it. nb: if parent is not null you must ensure that it is not closed while the busy info is shown.
wxbusyinfo::~wxbusyinfo~wxbusyinfo() hides and closes the window containing the information text.
|