24 TGCheckButton *fCheckMulti;
29 ~MyMainFrame()
override;
38void MyMainFrame::DoSelect()
43void MyMainFrame::DoExit()
54 fSelected =
new TList;
56 for (
int i = 0; i < 20; ++i) {
57 sprintf(tmp,
"Entry %i", i + 1);
58 fListBox->AddEntry(tmp, i + 1);
60 fListBox->Resize(100, 150);
63 fCheckMulti =
new TGCheckButton(
this,
"&Mutliple selection", 10);
65 fCheckMulti->Connect(
"Clicked()",
"MyMainFrame",
this,
"HandleButtons()");
69 show->
SetToolTipText(
"Click here to print the selection you made");
70 show->
Connect(
"Pressed()",
"MyMainFrame",
this,
"PrintSelected()");
73 exit->
Connect(
"Pressed()",
"MyMainFrame",
this,
"DoExit()");
78 SetWindowName(
"List Box");
82 Resize(GetDefaultSize());
89MyMainFrame::~MyMainFrame()
99void MyMainFrame::HandleButtons()
106 printf(
"HandleButton: id = %d\n",
id);
109 fListBox->SetMultipleSelections(fCheckMulti->GetState());
112void MyMainFrame::PrintSelected()
118 if (fListBox->GetMultipleSelections()) {
119 Printf(
"Selected entries are:\n");
120 fListBox->GetSelectedEntries(fSelected);
123 Printf(
"Selected entries is: %d\n", fListBox->GetSelected());
130 new MyMainFrame(
gClient->GetRoot(), 200, 200);
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
#define ClassDefOverride(name, id)
externTApplication * gApplication
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
A composite frame that layout their children in horizontal way.
This class describes layout hints used by the layout classes.
A listbox is a box, possibly with scrollbar, containing entries.
Defines top level windows that interact with the system Window Manager.
Yield an action as soon as it is clicked.
ROOT GUI Window base class.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.