lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Displaying messages during wx startup


From: Greg Chicares
Subject: [lmi] Displaying messages during wx startup
Date: Fri, 27 Mar 2009 12:15:18 +0000
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Consider the patch below, which attempts to display a warning message
on the first line of the main function. Is there some way to make the
wxLogWarning message get displayed, even before wx has been initialized?
I suspect the answer is "no", which is okay by me as long as I can find
a way to test whether it's not going to work--is there a way?

This reduced testcase is silly in itself, of course. What I'm really
looking for is a way to make this function robust:

// from 'alert_wx.cpp':
void warning_alert(std::string const& s)
{
    wxLogWarning(s.c_str());
    wxLog::FlushActive();
}

even when it's called during initialization of a global object.
I'm hoping there's a Condition() such that this will work:

+  if(Condition())
+    {
     wxLogWarning(s.c_str());
     wxLog::FlushActive();
+    }
+  else {safely_show_message(s);}


Index: main_wx.cpp
===================================================================
RCS file: /sources/lmi/lmi/main_wx.cpp,v
retrieving revision 1.132
diff -U 3 -r1.132 main_wx.cpp
--- main_wx.cpp 26 Mar 2009 16:47:29 -0000      1.132
+++ main_wx.cpp 27 Mar 2009 11:54:27 -0000
@@ -179,6 +179,9 @@
     )
 #endif // LMI_MSW defined.
 {
+safely_show_message("This gets displayed.");
+wxLogWarning("This doesn't get displayed.");
+wxLog::FlushActive();
     // WX !! and MPATROL !! Using wx-2.5.1 and mpatrol-1.4.8, both
     // dynamically linked to this application built with gcc-3.2.3,
     // three memory leaks are reported with:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]