PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Wrong icons (enabled/disabled) in the command bar!

I have a modal dialog with a command bar control.

So, to enable / disable some buttons of the command bar control I use the
OnUpdate???(CCmdUI* pCmdUI) function.

So, after I found out that the OnUpdate???(CCmdUI* pCmdUI) function
will not be called automatic (in the idle loop), I added the line
m_pWndEmptyCB->OnUpdateCmdUI((CFrameWnd *)this, TRUE); each time in the
program where I change the command bar state.

It works fine, always the right buttons are enabled / disabled.

I have only one problem!
Sometimes the wrong button icons (disabled/enabled icons)
are painted on the buttons.

When I have a disabled button it could be, that it have a "enabled icon".
And when I have a enabled button, it could be that it have a "disabled icon".
When I click on the enabled button, the right icon (enabled icon) will be painted!

Any idea to fix that problem??? It looks like missing a (re)painting message of the
command bar!

(I am working with embedded Visual C++ 3.0)

--
Nice greets, Daniel.
To force the framework to update the toolbar, etc, I use:

AfxGetMainWnd()->SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, 0, TRUE, TRUE);

Dan East
Thanks for your answer!

But does this function are also update the command bar of my modal dialog? Not only the toolbars, etc. from my main frame wnd?
I'm not certain. You may have to send that message to the dialog's hwnd instead.

Dan East