27 Int_t GetUnID(
void) {
return ++nID; }
30 class MyButtonTest :
public TGMainFrame {
34 TGVButtonGroup *fButtonGroup;
35 TGCheckButton *fCheckb[4];
36 TGRadioButton *fRadiob[2];
40 MyButtonTest(
const TGWindow *p, UInt_t w, UInt_t h);
41 virtual ~MyButtonTest();
44 void SetGroupEnabled(Bool_t);
46 ClassDef(MyButtonTest, 0)
49 MyButtonTest::MyButtonTest(
const TGWindow *p, UInt_t w, UInt_t h)
50 : TGMainFrame(p, w, h)
52 SetCleanup(kDeepCleanup);
54 Connect(
"CloseWindow()",
"MyButtonTest",
this,
"DoExit()");
57 TGHorizontalFrame *fHL2 =
new TGHorizontalFrame(
this, 70, 100);
58 fCheckb[0] =
new TGCheckButton(fHL2,
new TGHotString(
"Enable BG"),
60 fCheckb[0]->SetToolTipText(
"Enable/Disable the button group");
61 fHL2->AddFrame(fCheckb[0],
new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,
63 fButtonGroup =
new TGVButtonGroup(fHL2,
"My Button Group");
64 fCheckb[1] =
new TGCheckButton(fButtonGroup,
new TGHotString(
"CB 2"),
66 fCheckb[2] =
new TGCheckButton(fButtonGroup,
new TGHotString(
"CB 3"),
68 fCheckb[3] =
new TGCheckButton(fButtonGroup,
new TGHotString(
"CB 4"),
70 fRadiob[0] =
new TGRadioButton(fButtonGroup,
new TGHotString(
"RB 1"),
72 fRadiob[1] =
new TGRadioButton(fButtonGroup,
new TGHotString(
"RB 2"),
76 fHL2->AddFrame(fButtonGroup,
new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,
80 fCheckb[0]->Connect(
"Toggled(Bool_t)",
"MyButtonTest",
this,
81 "SetGroupEnabled(Bool_t)");
83 TGHorizontalFrame *fHL3 =
new TGHorizontalFrame(
this, 70, 100, kFixedWidth);
84 fExit =
new TGTextButton(fHL3,
"&Exit", IDs.GetUnID());
85 fExit->Connect(
"Clicked()",
"MyButtonTest",
this,
"DoExit()");
86 fHL3->AddFrame(fExit,
new TGLayoutHints(kLHintsExpandX));
87 AddFrame(fHL3,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,1,1,1,1));
91 fButtonGroup->SetState(kTRUE);
93 SetWindowName(
"My Button Group");
95 Resize(GetDefaultSize());
98 fButtonGroup->SetRadioButtonExclusive(kTRUE);
102 MyButtonTest::~MyButtonTest()
108 void MyButtonTest::DoExit()
116 gApplication->Terminate();
119 void MyButtonTest::SetGroupEnabled(Bool_t on)
121 fButtonGroup->SetState(on);
124 void buttongroupState()
126 new MyButtonTest(gClient->GetRoot(),100,100);