Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - A big problem for command bar system
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

A big problem for command bar system

 Post Reply Post Reply
Author
Message
lab_zj View Drop Down
Newbie
Newbie


Joined: 19 August 2004
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote lab_zj Quote  Post ReplyReply Direct Link To This Post Topic: A big problem for command bar system
    Posted: 14 September 2004 at 11:40pm

I have created a toolbar,a font combobox and font-size combobox placed in it,then I place this toolbar into a dialog,when I show this dialog,the problem appeared:

the selection change of font and font-size combobox no effect to my CRichEditCtrl.certainly,I have placed notify receiver that receive notify send from font and font-size combobox,BUT I have founded the notify receiver never called by dialog.Ok,then I read the source code of commandbar,I find this two combobox send it's notify to AfxGetMainWnd() finally,and not it's direct parent/owner(this dialog),SO,I can't receive notify from toolbar's combobox.

Who can give me some suggestions to solve this problem? thanks.

 

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2004 at 11:55pm

Add to your dialog (code from  CXTPFrameWndBase)

virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
 {
  if (message == WM_XTP_COMMAND)
  {
   LRESULT lResult = FALSE;
   NMHDR* pNMHDR = (NMHDR*)lParam;

   UINT nID = (UINT)pNMHDR->idFrom;
   int nCode = pNMHDR->code;

   AFX_NOTIFY notify;
   notify.pResult = &lResult;
   notify.pNMHDR = pNMHDR;
   if (OnCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), &notify, NULL))
   {
    *pResult = lResult;
    return TRUE;
   }
   return FALSE;
  }

  return TBase::OnWndMsg(message, wParam, lParam, pResult);
 }

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lab_zj View Drop Down
Newbie
Newbie


Joined: 19 August 2004
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote lab_zj Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2004 at 12:33pm

thank you very much,this problem I have solved by following method:

1. add message entry ON_MESSAGE(WM_XTP_COMMAND,OnXTPMsg)

2.  LRESULT CMyDialog::OnXTPMsg(WPARAM wParam,LPARAM lParam)

{

if(wParam==ID_COMMAND1)

{

...

return 1;

}

if(wParam==ID_COMMAND2)

{

...

return 1;

}

...

...

return SendMessage(WM_COMMAND,wParam,lParam);

}

then all command message from toolbar can be processed in general method.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.