From: Gorlash on 28 Jan 2010 16:42 I have a property sheet with two tabs on it. I have a default button on each sheet, and it works properly. I have an edit control that I type text into, and pressing <Enter> presses the "Send Command" button. If I type into the edit control, then TAB over to the "Send Command" button, <Enter> still works properly. However, if I close one tab of the property sheet, then on the other tab the default action is completely lost!! I can still *click* the "Send Command" button and it works, but <Enter> just does nothing. I added some debug code to dump Windows Message, and here's what I see: // before Close Port, <Enter> generates: CPort SubClass: [DM_GETDEFID] WM_COMMAND [CP]: command=BN_CLICKED, target=IDC_BTN_SEND CPort: [WM_ERASEBKGND] CPort: [WM_CTLCOLORDLG] WM_COMMAND [CP input]: command=10 WM_COMMAND [CP input]: command=4 WM_COMMAND [CP input]: command=3 CPort: [WM_PAINT] Cport WM_NOTIFY: [-113] LVN_ODCACHEHINT // after Close Port CPort SubClass: [DM_GETDEFID] Cport WM_NOTIFY: [-113] LVN_ODCACHEHINT So, DM_GETDEFID *is* getting called on <Enter>, but somehow the connection to the default button has been lost, so WM_COMMAND:BN_CLICKED is never generated. I tried fixing this (both in PSN_SETACTIVE, and in a separate debug function) with either: SendMessage(hwnd, DM_SETDEFID, IDC_BTN_SEND, 0 ); or: SendMessage(GetDlgItem(hwnd, IDC_BTN_SEND), BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE); but neither of these fix the problem (though they *are* getting executed). What am I missing here??
|
Pages: 1 Prev: What's Wrong With This Status Bar's CreateWindowEx()? Next: Clipboard internals |