This macro gives an example of how to use the TGTextViewostream widget.
Simply type a command in the "Command" text entry, then the output is redirected to theTGTextViewostream. To run it do either:
.x textviewostream.C
.x textviewostream.C++
{
protected:
public:
TextViewMainFrame();
virtual ~TextViewMainFrame() {}
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();
}
{
fTextView->Clear();
}
void TextViewMainFrame::HandleReturn()
{
std::string command = fCommand->GetText();
fTextView->ShowBottom();
}
void textviewostream()
{
new TextViewMainFrame();
}
- Author
- Bertrand Bellenot 06/01/2015
Definition in file textviewostream.C.