MFC radio button settings are selected by default

Source: Internet
Author: User

We assume that there are two RADIO controls: Idc_radio_single and Idc_radio_range, and our goal is to use the default selection of Idc_radio_single controls.

Method One:

Checkradiobutton (Idc_radio_single,idc_radio_range,idc_radio_single);

Method Two:

Set Idc_radio_single to have group attribute, idc_radio_range not;

CTRL + Double-click the Idc_radio_single button to add a member variable m_radio to it;

Add the following code when initializing radio:

m_radio=0;

UpdateData (FALSE);

Method Three:

cbutton* radio= (cbutton*) GetDlgItem (Idc_radio_single);

Radio->setcheck (1);

Or is the third way to be in favor of AH. This is also one of the common methods of accessing controls.

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.