Hi there, I have been looking through guitest.C to find a way of making a text entry box, which returns a value when a button is clicked. I have the following script, but don't know how to attach an action to the button. I notice in guitest.C ->Connect is used for what I assume is the same purpose, but when I try using it I get an error. My Script is: { TGMainFrame *fMain; TGCompositeFrame *fStatusFrame; TGTextEntry *fTestText; TGButton *fTestButton; fMain = new TGMainFrame(gClient->GetRoot(), 400, 220); fStatusFrame = new TGCompositeFrame(fMain, 60, 20, kHorizontalFrame | kSunkenFrame); fTestButton = new TGTextButton(fStatusFrame, "&Slice Energy at...", 8); fStatusFrame->AddFrame(fTestButton, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 0, 2, 2)); fTestText = new TGTextEntry(fStatusFrame, new TGTextBuffer(8)); fTestText->Resize(80, fTestText->GetDefaultHeight()); fStatusFrame->AddFrame(fTestText, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 2, 2, 2)); fMain->AddFrame(fStatusFrame, new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 0, 0, 1, 0)); fMain->SetWindowName("Enter Energy (eV)"); fMain->MapSubwindows(); // we need to use GetDefault...() to initialize the layout algorithm... fMain->Resize(200,30); //Resize(400, 200); fMain->MapWindow(); } The error when using Connect is: Error: Can't call TGTextButton::Connect("Clicked()","TestMainFrame",this,"DoButton()") in current scope FILE:func.C LINE:488
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET