Command message in Toolbar
DORIE@ris.risinc.com
Wednesday, February 28, 1996
specs: MSVC 4.0, win95
targeting: win95, mac and powermac
Here's my dilemma. I have a toolbar much like the format bar in
Wordpad. It has a couple of combo boxes and multiple buttons. I
want to be able to handle the ON_COMMAND messages for the buttons in
my toolbar class but apparently the message is not sent to my
toolbar. I have my ON_UPDATE_COMMAND_UI message handlers in this
toolbar class and they get called but the ON_COMMAND message handlers
are not. If I put the ON_COMMAND message handlers in my mainframe or
my view they are called but I really wanted my toolbar to be
completely encapsulated. Any ideas are greatly appreciated.
Thanks,
Dorie P. Hannan
Dorie@ris.risinc.com
Rohit Namjoshi -- namjoshi@slb.com
Monday, March 04, 1996
I had the same problem in MFC 3.0 and had to do the following to get around it.
Cheers... Rohit
--
Rohit Namjoshi namjoshi@austin.asc.slb.com
Schlumberger Austin Systems Center Vox: +1 512 331 3353
Austin, TX 78726, USA Fax: +1 512 331 3320
/////////////////////////////////////////////////////////////////////////////
// Give the toolbar a chance to handle WM_COMMAND
LRESULT CMyBar::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
if(WM_COMMAND == nMsg)
{
LRESULT lResult = CWnd::WindowProc(nMsg, wParam, lParam);
return lResult ? lResult : GetOwner()->SendMessage(nMsg, wParam, lParam);
}
return CToolBar::WindowProc(nMsg, wParam, lParam);
}
----------
From: DORIE@ris.risinc.com[SMTP:DORIE@ris.risinc.com]
Sent: Wednesday, February 28, 1996 15:48
To: mfc-l@netcom.com
Subject: Command message in Toolbar
specs: MSVC 4.0, win95
targeting: win95, mac and powermac
Here's my dilemma. I have a toolbar much like the format bar in
Wordpad. It has a couple of combo boxes and multiple buttons. I
want to be able to handle the ON_COMMAND messages for the buttons in
my toolbar class but apparently the message is not sent to my
toolbar. I have my ON_UPDATE_COMMAND_UI message handlers in this
toolbar class and they get called but the ON_COMMAND message handlers
are not. If I put the ON_COMMAND message handlers in my mainframe or
my view they are called but I really wanted my toolbar to be
completely encapsulated. Any ideas are greatly appreciated.
Thanks,
Dorie P. Hannan
Dorie@ris.risinc.com
| Вернуться в корень Архива
|