Discussion:
Enable Menu Entry In File Menu
(too old to reply)
Randolf Schultz
2006-01-24 08:44:51 UTC
Permalink
Hi,

in my DocView MFC application some menu entries in the File menu
(like e.g. Save and unfortunately also my own entry) are not
enabled until I click into the application window (regardless
of mouse button used). My ON_UPDATE_COMMAND_UI handler is also
not called (until this first click happens). I tried to send
myself this click using PostMessage() and mouse_event() to no
avail, only real clicks are accepted. I can also load documents
into my application using keyboard navigation only, but no
saving until I click. This is driving me mad. Do you have any idea?

best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World!
Tom Serface
2006-01-24 17:02:41 UTC
Permalink
Hi Randolf,

I've never seen this sort of thing. If you click on a menu that should give
your application the focus. So, clicking on the file menu should give the
application focus. The menu items should be enabled or disabled each time
the menu is expanded depending on the result of calls to the command UI
handlers. How are you expanding the menu if not by clicking on File? Just
trying to understand the problem better.

Tom
Post by Randolf Schultz
Hi,
in my DocView MFC application some menu entries in the File menu
(like e.g. Save and unfortunately also my own entry) are not
enabled until I click into the application window (regardless
of mouse button used). My ON_UPDATE_COMMAND_UI handler is also
not called (until this first click happens). I tried to send
myself this click using PostMessage() and mouse_event() to no
avail, only real clicks are accepted. I can also load documents
into my application using keyboard navigation only, but no
saving until I click. This is driving me mad. Do you have any idea?
best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World!
Randolf Schultz
2006-01-25 01:14:57 UTC
Permalink
Post by Tom Serface
Hi Randolf,
I've never seen this sort of thing. If you click on a menu that should give
your application the focus. So, clicking on the file menu should give the
application focus. The menu items should be enabled or disabled each time
the menu is expanded depending on the result of calls to the command UI
handlers. How are you expanding the menu if not by clicking on File? Just
trying to understand the problem better.
I do click on File. Sorry, I was not detailed enough. The click
that makes everything magically work as expected has to occur
in the area governed by my view, clicking into the menu,
toolbar or lower information bar does not help (that is why
I can open menus and see the mess == not enabled Save). It is
not a focus related issue, I can load documents and play
with them just fine using keyboard navigation. But I can not
save until I click...
Ah, one more note: until the first magic click, the disk icon
in the toolbar is also grayed out (disabled).
I did not start the project, but I think it was created by
AppWizard. The view is a CFormView. It contains a tree control
a list box and a home-brewn OpenSG control (3D) as well as some
tabs and sliders. A screenshot:
Loading Image...

best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World!
Tom Serface
2006-01-25 17:16:47 UTC
Permalink
Hi Randolf,

Could be your handler code is in the view so it has to be active before the
menu can handle it. You could move the handler code to the mainframe or app
code to make it more general. You might try using an OnCmdMsg() processor
in your mainframe code:

http://msdn2.microsoft.com/en-us/library/s765c671.aspx

Tom
Post by Randolf Schultz
Post by Tom Serface
Hi Randolf,
I've never seen this sort of thing. If you click on a menu that should give
your application the focus. So, clicking on the file menu should give the
application focus. The menu items should be enabled or disabled each time
the menu is expanded depending on the result of calls to the command UI
handlers. How are you expanding the menu if not by clicking on File?
Just
trying to understand the problem better.
I do click on File. Sorry, I was not detailed enough. The click
that makes everything magically work as expected has to occur
in the area governed by my view, clicking into the menu,
toolbar or lower information bar does not help (that is why
I can open menus and see the mess == not enabled Save). It is
not a focus related issue, I can load documents and play
with them just fine using keyboard navigation. But I can not
save until I click...
Ah, one more note: until the first magic click, the disk icon
in the toolbar is also grayed out (disabled).
I did not start the project, but I think it was created by
AppWizard. The view is a CFormView. It contains a tree control
a list box and a home-brewn OpenSG control (3D) as well as some
http://wwwicg.informatik.uni-rostock.de/~rschultz/ticiprep-screen.png
best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World!
Randolf Schultz
2006-01-28 07:55:02 UTC
Permalink
Tom Serface <***@msn.com> wrote:
[...]

It turned out to be related to the home-brewn OpenSG-MFC-Control.
I changed the invocation of its Create() from
m_Render.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0,0,100,100), this, AFX_IDW_PANE_FIRST, NULL);
to
m_Render.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0,0,100,100), this, AFX_IDW_PANE_FIRST+1, NULL);
what, magically, enabled the menu entries.
No, I have no idea, what I did there, I just saw the +1 somewhere on
msdn.microsoft.com...

best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World!
AliR
2006-01-24 23:06:44 UTC
Permalink
Does you application have an kinda of Docking windows? Are you using any
third party GUI libraries?

AliR.
Post by Randolf Schultz
Hi,
in my DocView MFC application some menu entries in the File menu
(like e.g. Save and unfortunately also my own entry) are not
enabled until I click into the application window (regardless
of mouse button used). My ON_UPDATE_COMMAND_UI handler is also
not called (until this first click happens). I tried to send
myself this click using PostMessage() and mouse_event() to no
avail, only real clicks are accepted. I can also load documents
into my application using keyboard navigation only, but no
saving until I click. This is driving me mad. Do you have any idea?
best regards,
Randolf,
--
http://www.ayam3d.org/ Reconstruct the World!
Loading...