MFC control (7): Split button

Source: Internet
Author: User
Tags sendmsg
Document directory
  • Message Processing

In vs2008, we can see that there isSplit button control, to view its effect, look at the QQ chat window "send", "message record" the two buttonsI know. Actually, there is something like combo box. But its implementation should be button plus menu. So its message processing can be split into button processing and menu processing.

Drag a split button to the dialog and bind it with a variable.

Csplitbutton m_sbsend;

Ddx_control (PDX, idc_split1, m_sbsend );

Because the split button is actually a combination of Button and menu, you have to make the entire menu first. It is not a special menu, it is also a commonly used menu on the home page.

M_split.Setdropdownmenu(Idr_menu1, 0); // Add the split button drop-down menu. the first parameter is the resource ID of the menu, and the second parameter is the sub-item index, that is, the menu root item is counted from the left to the right. we can only use one of its sub-menus here.

Message Processing

Message Processing and general buttons in the button section of the split buttonSame.

On_bn_clicked (idc_split1, onbnclickedsplit1)

Void cmfccontroldlg: onbnclickedsplit1 ()

{
Afxmessagebox (_ T ("Click split button "));
}

Processing of the drop-down menu

The processing of the drop-down menu in the split button is similar to that of the general menu.

On_command (id_split_menu1, sendmsg)

Void cmfccontroldlg: sendmsg ()
{
Afxmessagebox (_ T ("Click dropdown menu of split button "));
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.