-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @HoofedEar, glad to hear you are making an application with Terminal.Gui. Its hard to diagnose your problem without seeing more code but the approach should work. Here is a minimum repro that shows that the approach works. Are there any Threads involved in your code? If you are showing a form from another thread or something that could account in the behaviour you are describing? If so you should make sure to use Also make sure that the TextView you are setting the text on is the same one you can see on your window. If you created it but didn't add it to your window that could account for this. using Terminal.Gui;
Application.Init();
var w = new MyWindow();
Application.Run(w);
Application.Shutdown();
class MyWindow :Window
{
TextView tv = new TextView
{
Width = Dim.Fill(),
Height = Dim.Fill()
};
public MyWindow()
{
Add(tv);
}
public override void OnLoaded()
{
base.OnLoaded();
tv.Text = "hello";
}
} |
Beta Was this translation helpful? Give feedback.
That looks like it should work. When I remove the calls to EncryptFile and replace them with static strings it seems to work ok (see below).
One thing I would try is get rid of the
async
onSaveFileAsync
and getting rid of all calls toawait
. If that fixes the problem and threading (async) is needed you will need to useApplication.MainLoop.Invoke
as I described above when making updates to UI elements.using System.Text; using Terminal.Gui; Application.Init(); - FileHelpers.CurrentFile = DateTime.Now.ToShortDateString().Replace("/", "-"); Application.Run<MainWindow>(); public sealed class MainWindow : Window { private readonly TextView _textArea = new() { Y = 1, …