A simple example that shows the enabled and disabled state of a button group with radio and check buttons.
class IDList {
private:
public:
IDList() : nID(0) {}
~IDList() {}
Int_t GetUnID(
void) {
return ++nID; }
};
private:
IDList IDs;
public:
virtual ~MyButtonTest();
void DoExit(void);
};
{
Connect("CloseWindow()", "MyButtonTest", this, "DoExit()");
DontCallClose();
IDs.GetUnID());
fCheckb[0]->SetToolTipText("Enable/Disable the button group");
1, 1, 1, 1));
IDs.GetUnID());
IDs.GetUnID());
IDs.GetUnID());
IDs.GetUnID());
IDs.GetUnID());
fButtonGroup->Show();
1, 1, 1, 1));
AddFrame(fHL2);
fCheckb[0]->Connect("Toggled(Bool_t)", "MyButtonTest", this,
"SetGroupEnabled(Bool_t)");
fExit->Connect("Clicked()", "MyButtonTest", this, "DoExit()");
fCheckb[0]->SetOn();
fButtonGroup->SetState(
kTRUE);
SetWindowName("My Button Group");
MapSubwindows();
Resize(GetDefaultSize());
MapWindow();
fButtonGroup->SetRadioButtonExclusive(
kTRUE);
fRadiob[1]->SetOn();
};
MyButtonTest::~MyButtonTest()
{
Cleanup();
}
void MyButtonTest::DoExit()
{
}
void MyButtonTest::SetGroupEnabled(
Bool_t on)
{
fButtonGroup->SetState(on);
}
void buttongroupState()
{
new MyButtonTest(
gClient->GetRoot(),100,100);
}
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
- Author
- Roel Aaij 4/07/2007
Definition in file buttongroupState.C.