Print Page | Close Window

A big problem for command bar system

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1175
Printed Date: 19 May 2024 at 6:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: A big problem for command bar system
Posted By: lab_zj
Subject: A big problem for command bar system
Date 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.

 

 




Replies:
Posted By: Oleg
Date 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


Posted By: lab_zj
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net