Skip to content

Output window

tomdam edited this page Jun 17, 2020 · 1 revision

Output window is a feature of SPCoder that serves as application’s standard output. By default the window is located at the right side of the main screen.

You can write any data to output window from your C# code.

Standard C# Console output

Standard output for the code that is executed using SPCoder is the Output window. That means that if you execute Console.WriteLine("some string"); it will write "some string" to the Output window.

SPCoder print method

You can also achieve the same thing by calling SPCoder's print("string") or println("string") methods. Those are just shortcuts for Console.Write() and Console.WriteLine() methods.

Reference output object directly

The other way of interacting with output window is by directly referencing it by using main.OutputWindow.RtOutput object. Since it is a standard System.Windows.Forms.RichTextBox, the text can be writen to it by using its Text property.

main.OutputWindow.RtOutput.Text += "Roslyn rullezz!"; 

The following example shows different usages of Output window:

Console.WriteLine("Hello world");

Console.Write("Hello ");
Console.Write("roslyn");

println("\n\n");

println("Hello world");

print("Hello ");
print("roslyn");

main.OutputWindow.RtOutput.Text += "\nRoslyn rullezz!\n";

println(main.Text);

Output 1

Next interesting example shows how we can access the text in current code editor and write it to output window:

println( main.ActiveDocument.Fctb.Text );

Output 2

Settings

Output window contains one setting. It is a checkbox Clear output before new execution. That checkbox controls the behaviour of SPCoder's output mechanism.

If it is selected, the output will be cleared at the beginning of every execution.

If you want to retain previous state of the Output window between code executions, you can uncheck that checkbox.