class TestMainFrame: public TGMainFrame { private: TGListBox *MyListBox; private: TGTextEdit *MyTextEdit; public: void Slot_HandleProcessedEvent(Event_t *Event) { MyTextEdit->AddLine("((TGLBContainer*)MyListBox->GetContainer())->GetSelected()): "+TString::Format("%d", ((TGLBContainer*)MyListBox->GetContainer())->GetSelected())); MyTextEdit->ShowBottom(); } public: TestMainFrame(const TGWindow *p): TGMainFrame(p) { AddFrame(MyListBox=new TGListBox(this), new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY)); AddFrame(MyTextEdit=new TGTextEdit(this), new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY)); for (Int_t Counter=0; Counter<10; Counter++) { MyListBox->AddEntry("Item "+TString::Format("%d", Counter), Counter); } MapSubwindows(); Resize(700, 500); MapWindow(); MyListBox->Connect("ProcessedEvent(Event_t*)", "TestMainFrame", this, "Slot_HandleProcessedEvent(Event_t*)"); } }; void test() { new TestMainFrame(gClient->GetRoot()); }