[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] EVT_UPDATE_UI occurring when !wxTheApp->IsActive()
From: |
Greg Chicares |
Subject: |
[lmi] EVT_UPDATE_UI occurring when !wxTheApp->IsActive() |
Date: |
Mon, 13 Mar 2006 17:11:43 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Vadim--I've "fixed" a problem, but I'd like to ask you to take a look
at it and tell me whether I've done it in the best way.
* Observable symptom
Using lmi just before the change committed Mar 13 16:45:09 2006 UTC,
or apparently any version since Fri Dec 2 05:18:38 2005 UTC, under msw:
- do 'File | New | Illustration'
- focus any control other than the first control on the notebook page
- switch to any other application with alt-Tab
- switch back to lmi
Now, the control you had focused has lost focus, and the first control
on the notebook page is focused instead.
* Proximate cause
In 'xml_notebook.cpp', XmlNotebook::EnsureOptimalFocus() is called by
XmlNotebook::UponUpdateGUI(), the EVT_UPDATE_UI handler. When a task
switch occurred, XmlNotebook::EnsureOptimalFocus() called FindFocus(),
which returned null. Treating this as a problem it needed to fix,
XmlNotebook::EnsureOptimalFocus() focused the first control on the
notebook page.
Experimentally adding
if(!wxTheApp->IsActive()) return;
at the top of XmlNotebook::EnsureOptimalFocus() prevented the symptom.
However, that is not the change I committed.
* Ultimate cause
I believe the underlying problem is that XmlNotebook::UponUpdateGUI()
was called when the application wasn't active. Shouldn't that ideally
be prevented?
I added code equivalent to
if(!wxTheApp->IsActive()) return;
at the top of XmlNotebook::UponUpdateGUI(): that's the change I
committed on Mar 13 16:45:09 2006 UTC. This prevents the observable
symptom described above. I conjecture that this is the best way to
address the problem: I see no reason why EVT_UPDATE_UI events should
be sent while the application is not active, and I suppose that those
events might have other deleterious consequences that we just haven't
noticed yet.
- [lmi] EVT_UPDATE_UI occurring when !wxTheApp->IsActive(),
Greg Chicares <=