Click to See Complete Forum and Search --> : ON_UPDATE_COMMAND_UI Doubt
pkraman
May 1st, 1999, 01:35 AM
hi,
I created an Update UI handler for the menu item "Open". when I moved the cursor to the FILE menu, immediately the Open UI handler is called. how does it happen. Actually the handler has to be called only when I select the menu item OPEN. isn't it. Can any one explain this. I am new to vc++.
Thanks in advance,
Kalyan
Sean Lee
May 1st, 1999, 01:43 AM
sorry. :)
pkraman
May 1st, 1999, 02:06 AM
Hi Lee,
Thanks for your reply. i have got one more doubt. suppose if i have two UI Menu handlers and i want to execute the handler only if the coresponding menu item is selected, how to implement it.
for example, if I select the Copy or Cut menu, then only the Paste menu has to be activated. how to implement it.
Regards,
Kalyan
Sean Lee
May 1st, 1999, 02:35 AM
For example,(just for example)
void CExampleView::OnEditCopy()
{
// if copied
m_bCopied = TRUE;
// else
// m_bCopied = FALSE;
}
void CExampleView::OnUpdateEditPaste(CCmdUI* pCmdUI)
{
pCmdUI->Enable = m_bCopied;
}
I wish that my reply is helpful to you. :)
U told that update command ui is called if there is no message in the queue , then what about the WM_IDLE message will do?
Sean Lee
May 1st, 1999, 03:09 AM
Sorry, it is a mistake.
Thanks for pointing out my fault.
When the user clicks the mouse in the menu, ON_UPDATE_COMMAND_UI handlers are called.
Because I have recently developed applications using C++ Builder for a few months and I used WM_IDLE message handler for updating the state of UI objects(ie. buttons and so on) in form-based application, I made a mistake.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.