class myWindow : public TGMainFrame { public: myWindow(); ~myWindow(); void Start(); void Continue(); void Finish(); void HandleTimer(); enum EEntry { kStartButton, kContinueButton, kFinishButton }; private: TGTextButton* fStartButton{nullptr}; TGTextButton* fContinueButton{nullptr}; TGTextButton* fFinishButton{nullptr}; TGTextButton* fEmitter{nullptr}; TGLabel* fTestLabel{nullptr}; }; myWindow::myWindow() { fTestLabel = new TGLabel(this, "test"); AddFrame(fTestLabel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0)); fStartButton = new TGTextButton(this, "Start", kStartButton); AddFrame(fStartButton, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0)); fStartButton->Connect("Clicked()", "myWindow", this, "Start()"); Layout(); MapSubwindows(); MapWindow(); Resize(200, GetDefaultHeight()); } myWindow::~myWindow() { } void myWindow::Start() { fEmitter = fStartButton; TTimer::SingleShot(100, "myWindow", this, "HandleTimer()"); } void myWindow::Continue() { fEmitter = fContinueButton; TTimer::SingleShot(100, "myWindow", this, "HandleTimer()"); } void myWindow::Finish() { fFinishButton->Disconnect("Clicked()", this, "Finish()"); CloseWindow(); } void myWindow::HandleTimer() { if (fEmitter == fStartButton) { fStartButton->Disconnect("Clicked()", this, "Start()"); HideFrame(fStartButton); RemoveFrame(fStartButton); delete fStartButton; fStartButton = nullptr; fContinueButton = new TGTextButton(this, "Continue", kContinueButton); AddFrame(fContinueButton, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0)); fContinueButton->Connect("Clicked()", "myWindow", this, "Continue()"); } else if (fEmitter == fContinueButton) { fContinueButton->Disconnect("Clicked()", this, "Continue()"); HideFrame(fContinueButton); RemoveFrame(fContinueButton); delete fContinueButton; fContinueButton = nullptr; fFinishButton = new TGTextButton(this, "Finish", kFinishButton); AddFrame(fFinishButton, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0)); fFinishButton->Connect("Clicked()", "myWindow", this, "Finish()"); } MapSubwindows(); Layout(); } void guitest() { new myWindow; }