[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Proposal: Adding a class to automatically manage the wait cursor and OK button enabled status

From: Friedrich Brunzema <brunzefb_at_yahoo.com>
Date: Thu, 30 May 2013 13:38:46 -0700 (PDT)

Hi,

Trying to remove the following duplicated code:

m_pLogDlg->DialogEnableWindow(IDOK, FALSE);
m_pLogDlg->SetPromptApp(&theApp);
theApp.DoWaitCursor(1);

which at every exit of the method has to finish with
m_pLogDlg->EnableOKButton();
theApp.DoWaitCursor(-1);

You use the the class like this
CLogDlg::SomeMethod()
{
     LogWndHourglass hourglass(this);
     // other stuff happens
} // as soon as we go out of scope, the wait cursor stops.

I have an implementation below - let me know if you like this or not.

Friedrich Brunzema

Proposed implementation:
+LogWndHourglass::LogWndHourglass(CLogDlg* parent) : m_pLogDlg(parent)
+{
+ if (m_pLogDlg != NULL)
+ {
+ m_pLogDlg->DialogEnableWindow(IDOK, FALSE);
+ m_pLogDlg->SetPromptApp(&theApp);
+ theApp.DoWaitCursor(1);
+ }
+}
+
+LogWndHourglass::~LogWndHourglass()
+{
+ if (m_pLogDlg != NULL)
+ {
+ m_pLogDlg->EnableOKButton();
+ theApp.DoWaitCursor(-1);
+ m_pLogDlg = NULL;
+ }
+}

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=3056644

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2013-05-30 22:38:49 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.