Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dialog Menu Check

NitroAtomNitroAtom Member Posts: 12
I'm trying to write my own version of Minesweep, just like the one that comes with windows. On the menu I want to put checks next to Beginner, Intermediate, Expert, or Custom. I tried using ON_UPDATE_COMMAND_UI; pCmdUI->SetCheck(TRUE); but that doesn't work, all the menu items stay unchecked. I even tried getting a pointer to the sub menu and calling subMenu->CheckItem(ID_FILE_BEGIN, TRUE) (or whatever the function is called), and that didn't work either. Is there a step I'm missing or is there a different way to do this for dialog based apps; I've used the exact same method for window apps before and it works fine.

Comments

  • kuphrynkuphryn Member Posts: 266
    [b][red]This message was edited by kuphryn at 2002-10-13 16:27:48[/red][/b][hr]
    Override OnInitMenuPopup() and add this code.

    -----
    void CWordCountDlg::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
    {
    // Enables this dialog based app to handle ON_UPDATE_COMMAND_UI messages.
    // For updating items in menu.
    CDialog::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
    CCmdUI cmdUI;
    cmdUI.m_pMenu = pPopupMenu;
    cmdUI.m_nIndexMax = pPopupMenu->GetMenuItemCount();

    for (cmdUI.m_nIndex = 0; cmdUI.m_nIndex < cmdUI.m_nIndexMax; cmdUI.m_nIndex++)
    {
    cmdUI.m_nID = pPopupMenu->GetMenuItemID(cmdUI.m_nIndex);

    if (cmdUI.m_nID == 0)
    continue;

    cmdUI.DoUpdate(this, FALSE);
    }
    }
    -----

    Kuphryn
  • Justin BibJustin Bib USAMember Posts: 0

    _________ [ http://forcoder.org ] free ebooks and video tutorials about \ Perl, Swift, Visual Basic, MATLAB, JavaScript, Go, Visual Basic .NET, C++, Scratch, Python, Delphi, PL/SQL, Objective-C, C, Java, Ruby, Assembly, PHP, C#, R LabVIEW, Scheme, ML, Prolog, Rust, Transact-SQL, Alice, Bash, D, Ada, Lisp, ABAP, Julia, Hack, Apex, COBOL, Lua, F#, Crystal, Clojure, Erlang, Logo, SAS, Dart, VBScript, Awk, Kotlin, Scala, FoxPro, Fortran \

Sign In or Register to comment.