Home > Software engineering >  About MFC dialog box in the toolbar button functions
About MFC dialog box in the toolbar button functions

Time:09-29

 

Has added on the dialog box toolbar "save" and "file" button, but I don't know how to add response function, and realize the function of the code and I don't know, (I'm compiling a program of computing functions, is to want to know how to save these calculated data)

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

To solve it, I have baidu for two days, no suitable

CodePudding user response:

1 add a toolbar resources
Article 2 creation tool in the init
//TODO: Add extra initialization here
//| CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_FIXED
if (! M_wndToolBar. CreateEx (this, TBSTYLE_FLAT WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS) | |
! M_wndToolBar. LoadToolBar (IDR_MAINFRAME))
{
AfxMessageBox (" Failed to create the toolbar \ n ");
return -1;//fail to create
}
3 response ID_XXX command

CodePudding user response:

Right click on button, add a message response, like add menu message response

CodePudding user response:

On the button to set the ID, On_Command associated to the corresponding handler, add a handler function, three steps

CodePudding user response:

Add a WM_COMMAND ON_COMMAND message map

CodePudding user response:

Or overloaded dialog OnCommand function directly with
 BOOL CXXXDlg: : OnCommand (WPARAM WPARAM, LPARAM LPARAM) 
{
UINT uID=LOWORD (wParam);
UINT uNotify=HIWORD (wParam);
If (uNotify==BN_CLICKED)
{
The switch (uID)
{
Case (IDM_XXXX) :
{
AfxMessageBox (_T (" XXXXX "));
break;
}
}
}

Return __super: : OnCommand (wParam, lParam);
}

CodePudding user response:

reference 4 floor jacksonfan response:
right click on button, add a message response, like add menu message response

Is not the same./right-click didn't respond

CodePudding user response:

Right click on button, add a message response, like add menu message response


From the resource bar to the point,
  • Related