Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

command<>

2004-12-18
2013-04-15
  • Steven Weiss
    Steven Weiss
    2004-12-18

    hi john,
    the last few hours i spent tracking down an unobvious bug...my event handler looked like this:

    handle_event on_edit()
    {       
        create_modal_dlg<EditDlg> ( window() ).wait();
        return command<IDC_BTN_EDIT> ().HANDLED_BY(&me::on_edit);
    }

    i don't know if you see it immediately...but the problem is that the second parameter to command is by default ANY_CMD_CODE.

    when i clicked on the button the dialog popped up but when i tried to close it it simple popped up again. as i now know another WM_COMMAND is sent to the button so the dialog reopens.

    this is a very hidden origin of bugs and because it will be less common to catch all WM_COMMANDs for an id can you put away the default parameter? or at least put a comment into the docs warning about this behaviour?

    mfg steven

     
    • John Torjo
      John Torjo
      2004-12-19

      Hi Steve,

      I will look into it, early next week.

      Best,
      John