ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • #TRadioGroup
    C++ Builder/Control 2018. 12. 6. 22:41

    #TRadioGroup

     

    Vcl.ExtCtrls.TRadioGroup


    TRadioGroup 함께 작동하는 라디오 버튼 그룹을 나타냅니다.

    TRadioGroup 개체는 라디오 버튼만을 포함한 특수 그룹 상자입니다. 같은 컨트롤 구성 요소에 직접 배치 된 복수의 라디오 버튼은 "그룹화"되어 있습니다. 사용자가 하나의 라디오 버튼을 선택하면 해당 그룹의 다른 모든 라디오 버튼은 꺼집니다. 따라서 하나의 폼에서 두 개의 라디오 버튼이 동시에 켜지는 그들이 다른 컨테이너 (그룹 상자 등)에 배치되어있는 경우만입니다.

    라디오 버튼을 TRadioGroup 에 추가하려면 오브젝트 인스펙터의 Items 속성을 편집합니다. Items 각 문자열이 그룹 상자에 표시되는 라디오 버튼입니다 그 문자열이 캡션입니다. ItemIndex 속성 값은 현재 s선택되어있는 라디오 버튼을 나타냅니다.

    라디오 버튼을 1 열로 표시하거나 여러 열에 표시 여부는 Columns 속성의 설정에 의해 결정됩니다.

    참고 : 라디오 그룹의 BiDiMode을 bdRightToLeft로 설정하면 라디오 버튼이 자동으로 반대 방향입니다. FlipChildren 메소드는 무효입니다.

    RadioGroupItems (C++)

    Description

    This example uses a radio group box and a scroll bar on a form. When you select one of the radio buttons, the scroll bar changes orientation accordingly.

    Code

    __fastcall TForm1::TForm1(TComponent* Owner)
     : TForm(Owner)
    {
     RadioGroup1->Items->Add("Vertical");
     RadioGroup1->Items->Add("Horizontal");
     RadioGroup1->ItemIndex = 2;
    }

    void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
    {
     if (RadioGroup1->Items->Strings[RadioGroup1->ItemIndex] == "Vertical")
       ScrollBar1->Kind = sbVertical;
     else if (RadioGroup1->Items->Strings[RadioGroup1->ItemIndex] == "Horizontal")
       ScrollBar1->Kind = sbHorizontal;
    }


    @Columns

    // 열의 개수 표현

    라디오 버튼을 수평으로 정렬할때 사용.


    ex)

    UnicodeString sRdTest;

    for(int i=0; i<rdCtrlData->Items->Count; i++){

    sRdTest = rdCtrlData->Items->Strings[i];

    ShowMessage(sRdTest);

    }



    return;

    // 아이템인덱스 숫자만큼 숫자에 해당하는 아이템이름 메세지 출력.

    rdCtrlData / <-- 라디오그룹 name

    TRadioGroup->Items->Strings[Index];        // Index번째의 버튼 이름 반환.

    #TRadioButton

    Checked // false 는 0반환 true는 1반환


    728x90

    'C++ Builder > Control' 카테고리의 다른 글

    #TDriveComboBox  (0) 2019.01.11
    #TTimer  (0) 2019.01.11
    #IdTCPServer  (0) 2019.01.08
    TComboBox  (0) 2018.12.06
    TPanel  (0) 2018.12.06

    댓글

Designed by Tistory.