Capturing toolbar events inside a dialog class
Hi Guys,
I have a Dialog Resource in my resourceEditor & I have created a class out of it say "C_TestDialog",which is derived from CDialog.
I want to place a Toolbar control in this dialog. So I have added a "ToolBarcontrol" also in my resourceEditor.
Now If I take my ClassWizard,& select the "C_TestDialog" under class name.In the "ObjectIDs" section I see my classname & in the Messages column,I see all of the events,messages etc of this class.
Now What I need now is,How can I include my "toolbarcontrol" also inside the ObjectIDs section,under the className "C_TestDialog",so that I can see all the messages related to the toolbar control.
RightNow,If I select my toolBarcontrol(IDR_SelectToolBar) inside the ObjectIDs section,I see only 2 messages - "COMMAND" & "UPDATE_COMMAND_UI".
Iam creating my toolbar as follows:
CRect toolbarSize(20,20,300,50);
//m_toolBarCtrl is the member varibale of type C_ToolBarCtrl--
which is a member of C_TestDialog class.
m_toolBarCtrl.Create(WS_CHILD|TBSTYLE_FLAT,toolbar Size,this,IDR_SelectToolBar);
m_toolBarCtrl.AddBitmap(1,IDB_BITMAP1);
TBBUTTON tb[2];
// Index of new button image.
tb[0].iBitmap = 0;
// Setting button state
tb[0].fsState = TBSTATE_ENABLED;
// Setting button style
tb[0].fsStyle = TBSTYLE_BUTTON;
tb[0].dwData = 0;
tb[0].iString = NULL;
m_toolBarCtrl.AddButtons(1,tb);
m_toolBarCtrl.ShowWindow(true);
Note:
Don't want to create a class derived from CToolBarCtrl.Want to access the Messages of the "toolbar" from my C_TestDialogClass.(For eg.- when the user clicks on the toolbar at runtime,I want this event to be trapped inside my C_TestDialog class)
Any Help is appreciated.
Thanks...
|