Tips for using the single-choice button (radio button)

Source: Internet
Author: User
1. Group Single-choice buttons:
Set attributes for the first single-choice button in each group: group, tabstop, and auto. Set attributes for other buttons: tabstop and auto.
For example:
Radio1, Radio2, and radio3 are a group, and radio4 and radio5 are a group.
Set radio1 attributes: group, tabstop, auto
Set the Radio2 attribute: tabstop, auto
Set the radio3 attribute: tabstop, auto
Set radio4 attributes: group, tabstop, and auto
Set the radio5 attribute: tabstop, auto
2. Use classwizard to define variables for single-choice controls. Each group can only define one variable. For example, m_radio1 and m_radio4.
3. Use classwizard to generate the click message function of each radio button and add the following content:
Void cweditview: onradio1 ()
{
M_radio1 = 0; // The first radio button is selected.
}
Void cweditview: onradio2 ()
{
M_radio1 = 1; // The second radio button is selected.
}
Void cweditview: onradio3 ()
{
M_radio1 = 2; // The third radio button is selected.
}
Void cweditview: onradio4 ()
{
M_radio4 = 0; // The fourth radio button is selected.
}
Void cweditview: onradio5 ()
{
M_radio4 = 1; // The fifth radio button is selected.
}
When the control variable value is 0, the first radio button of the corresponding group is selected.
Bool cdzyapp: initinstance ()
...{
Afxenablecontrolcontainer ();
......

// The one and only window has been initialized, so show and update it.
M_pmainwnd-> setwindowpos (null, 750,555, 750, swp_nomove); // set the initial size of the window to 555 *
M_pmainwnd-> showwindow (sw_show );
M_pmainwnd-> updatewindow ();

Return true;
}

M_pmainwnd-> centerwindow (getdomaintopwindow ());
Int cmainframe: oncreate (maid ){
If (cframewnd: oncreate (lpcreatestruct) =-1)
Return-1;
......

// Todo: delete these three lines if you don't want the toolbar
// Be dockable
M_wndtoolbar.enabledocking (cbrs_align_any );
Enabledocking (cbrs_align_any );
Dockcontrolbar (& m_wndtoolbar );

Centerwindow (getshorttopwindow (); // place the window in the center of the screen when it is opened

Return 0;
}

Bool ctexteditordoc: onnewdocument (){
If (! Cdocument: onnewdocument ())
Return false;
// Todo: Add reinitialization code here
// (SDI documents will reuse this document)
Settitle ("Unnamed .txt"); // you can specify the document title.
Return true;
}

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.