Simply type a command in the "Command" text entry, then the output is redirected to theTGTextViewostream. To run it do either:
{
protected:
public:
TextViewMainFrame();
virtual ~TextViewMainFrame() {}
void Reset();
void HandleReturn();
};
{
fCommand =
new TGTextEntry(fCommandFrame, (
const char *)
"", 20);
fCommand->Connect("ReturnPressed()", "TextViewMainFrame", this, "HandleReturn()");
fCommandFrame->AddFrame(
new TGLabel(fCommandFrame,
"Command: "),
fReset->SetToolTipText("Press to clear the command entry\nand the TGTextView", 200);
fReset->Connect("Clicked()", "TextViewMainFrame", this, "Reset()");
fExit->SetToolTipText("Terminate the application", 200);
fExit->Connect(
"Pressed()",
"TApplication",
gApplication,
"Terminate()");
Connect(
"CloseWindow()",
"TApplication",
gApplication,
"Terminate()");
DontCallClose();
MapSubwindows();
Resize(GetDefaultSize());
SetWindowName("TGTextView Demo");
MapRaised();
}
void TextViewMainFrame::Reset()
{
fCommand->Clear();
fTextView->Clear();
}
void TextViewMainFrame::HandleReturn()
{
std::string command = fCommand->GetText();
fTextView->ShowBottom();
fCommand->Clear();
}
void textviewostream()
{
new TextViewMainFrame();
}
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
R__EXTERN TSystem * gSystem
const char * Data() const
virtual TString GetFromPipe(const char *command)
Execute command and return output in TString.