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
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
A composite frame that layout their children in vertical way.
const char * Data() const
virtual TString GetFromPipe(const char *command)
Execute command and return output in TString.