[Top][All Lists]

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

Re: [lmi] NDEBUG [Was: PDF opening errors]

From: Greg Chicares
Subject: Re: [lmi] NDEBUG [Was: PDF opening errors]
Date: Fri, 24 Oct 2014 02:13:45 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 2014-10-23 12:39Z, Greg Chicares wrote:
>> GC> The reason why I ask is that I'm wondering if there's some way I could
>> GC> (optionally) enable messages like this in the production system (say,
>> GC> only with a special command-line argument).

I could use some advice here. Clearly I can copy this code from 'wx_test':
  wxLogWindow(NULL, "Log Messages", true, false)
into Skeleton::OnInit(), and (subject to some command-line switch) see the
log messages. But I'm not sure about the best way to do this.

I'm not even sure where to create the log window. I suppose I should create
it as early as possible, so that I don't miss any log messages arising in
OnInit(). To make the log window conditional on a command-line argument, I
need to write it after ProcessCommandLine() (which, at least for now, does
not call any wx functions, so no wx diagnostics will be missed).

Would it be better to create the log window after
  frame_ = new(wx) wxDocMDIParentFrame(...
so that I can make that frame its parent? or after the frame is shown:
in case that matters? I was thinking it might be nicer to view the log in
a child window. But OTOH it's not enormously nicer. And anyway it didn't
behave like an MDI child, and maybe it's silly to hope that it would.

What if I combine those two ideas: create wxLogWindow as early as possible,
and then Reparent() it? The documentation indicates that wxLogWindow is not
a wxWindow, but maybe I can call wxLogWindow::GetFrame() and Reparent() the
result, making it a child of my wxDocMDIParentFrame? Or am I fighting too
hard against the tide here?

Anyway--I experimented a little with creating the wxLogWindow at various
times, and adding a few wxLogMessage() and wxLogDebug() calls...and the
outcome seemed to vary if I created wxLogWindow late in OnInit(). Some
messages that preceded wxLogWindow creation were shown as messageboxes,
but others (like the
  'SendMessage(WM_MDISETMENU)' failed with error 0x00000008
message mentioned here:
) didn't show up at all. Is this just the way the logging system works
by design--showing only the highest-priority messages in a messagebox?
And, if I really want to see every single log message, is this experiment
just telling me to create the wxLogWindow as early as possible?

Suppose I create wxLogWindow early, with the 'show' argument set to false,
and then Show() it later--will that prevent me from losing any messages?

Is there any function that tells me whether or not any messages have been
logged? I was thinking it might be nice to show the log window only if it
would not be empty. I can't really say whether this (or other ideas above)
would be good until I see it, but I'm not even sure whether it can be done.

One last question: is wxLogWindow one of those classes that should be
instantiated only on the heap, and never on the stack?

reply via email to

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