CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 1999
    Location
    Chennai, INDIA
    Posts
    27

    ON_UPDATE_COMMAND_UI Doubt

    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


  2. #2
    Join Date
    May 1999
    Posts
    8

    Re: ON_UPDATE_COMMAND_UI Doubt

    sorry.


  3. #3
    Join Date
    Apr 1999
    Location
    Chennai, INDIA
    Posts
    27

    Re: ON_UPDATE_COMMAND_UI Doubt

    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


  4. #4
    Join Date
    May 1999
    Posts
    8

    Re: ON_UPDATE_COMMAND_UI Doubt

    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.


  5. #5
    Guest

    Re: ON_UPDATE_COMMAND_UI Doubt

    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?


  6. #6
    Join Date
    May 1999
    Posts
    8

    Re: ON_UPDATE_COMMAND_UI Doubt

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured