CXTP-derived class can't get WM messages |
Post Reply |
Author | |
admitriev
Newbie Joined: 24 November 2008 Location: Russian Federation Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: 03 December 2008 at 11:11am |
Hi all,
A few days ago I suddenly ran into the problem I would have never imagine to happen with MFC code before.
There's a need to dynamically create a CXTPToolBar-derived class object with some buttons attached to it. When I finished with that and started writing the control part of my code, I found that my class object couldn't get any messages from outside (not even user-defined ones).
Here's how my I've been trying to do that:
BEGIN_MESSAGE_MAP(DynamicToolBar, CXTPToolBar) ON_COMMAND_RANGE( ID_STD_SUMMARY_OBJECT, ID_EXT_BLOCK_OBJECT + 8, OnOptionSelect) END_MESSAGE_MAP() ...
class DynamicToolBar: public CXTPToolBar
//DynamicToolBar message handlers protected :afx_msg virtual LRESULT OnControlSelected(WPARAM wParam, LPARAM lParam);afx_msg void OnOptionSelect(UINT nID);DECLARE_MESSAGE_MAP() No suprises, right?
And below is how I create my toolbar. I must say that my code works in a separate DLL and I can't use CommandBars the way it's used in several samples provided by CJ.
// create a toolbar for the active communication if( !communicationToolBar_.CreateToolBar(WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, acedGetAcadFrame()) ) { .... where acedGetAcadFrame return a pointer to the CMDIFrameWnd object of the main application.
Could anybody gimme a hint on what might be wrong here and how it could be worked around?
many thanks for any help, guys!
- alex |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Our Toolbar and Standard Toolbar (I sure it will work same) send WM_COMMAND to parent/owner class - not to self. Catch it in parent dialog/frame.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
admitriev
Newbie Joined: 24 November 2008 Location: Russian Federation Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi Oleg,
many thanks for your prompt reply. both your and standard toolbar work the way you said, indeed! However, it wouldn't have solved my issue in any case since I don't have an access to the parent frame code. What I tried to do is to override OnChildNotify method just like we used to do in MFC-based toolbars. I was really suprised when did find that the only message came into OnChildNotify was WM_PARENTNOTIFY. No WM_COMMAND messages've come into this handler. I implemented this exactly the same way we used to do toolbars for MFC code.
Any ideas on how this issue could be sorted out, Oleg?
Many thanks in advance,
- Alex
P.S. I've double-checked this via Spy++ and it looks like the parent frame receives my WM_COMMAND but doesn't notify my control...
|
|
admitriev
Newbie Joined: 24 November 2008 Location: Russian Federation Status: Offline Points: 8 |
Post Options
Thanks(0)
|
hi,
is there anybody who could provide me with a suggestion on how to resolve this issue? it's quite urgent since it's been blocking my delivery which is always stressful enough... :)
if you need more details about this case, please just gimme a shout...
thanks,
- Alex
PS I've just tried to reflect WM_COMMAND messages by putting ON_CONTROL_REFLECT into the message map of my control but it've not had any effect... :( Having surfed several internet forums, I've noticed quite a few questions related to my issue but no fully-working solution yet...
|
|
admitriev
Newbie Joined: 24 November 2008 Location: Russian Federation Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi, any updates on this issue?
thanks,
- Alex
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |