Re: Dialog AND a custom Toolbar
"RAN" <nijenhuis@wish.nl> wrote in message
news:1187382707.239900.302220@22g2000hsm.googlegroups.com...
On Aug 17, 10:08 pm, "Mark Salsbery [MVP]"
Show quoted text -
I have read the document from MSJ:
Unfortunately, this wonderful UI update mechanism doesn't work for
dialogs-at least not automatically. You have to hook the pieces up
yourself. Fortunately, it's easy. All you have to do is handle
WM_KICKIDLE, a private MFC message that MFC sends whenever the dialog
is idle (analogous to the app's OnIdle handler) to call
UpdateDialogControls yourself.
LRESULT CTabDialog::OnKickIdle(WPARAM wp,
LPARAM lCount)
{
UpdateDialogControls(this, TRUE);
return 0;
}
CWnd::UpdateDialogControls sends the magic CN_ UPDATE_COMMAND_UI
message to all the dialog controls, the upshot being that now
ON_COMMAND_ UPDATE_UI handlers suddenly work for dialogs.
I have added the messagehandler for OnKickIdle but it is never called,
als the UPDATE_COMMAND_UI handler is never called, am i forgetting
something, do i have to extra stuff to make this work ?
The only thing i have added is this handler in my dialog:
LRESULT CClientDlg::OnKickIdle(WPARAM wParam, LPARAM lParam)
{
UpdateDialogControls(this, TRUE);
return 0;
}
First, this is a modal dialog, right? (to make sure I'm on the same page
here :))
Second, have you added the message map entry for WM_KICKIDLE?
ON_MESSAGE(WM_KICKIDLE, &CClientDlg::OnKickIdle)
As far as the command enablers, generally this is done in the control's
parent (your dialog) but it appears you are doing it in the toolbar class,
correct? If so, and it's still not getting called, have you tried moving it
to the dialog class?
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++