TGUI Forum

Ports and bindings => DotNet => Topic started by: densm27 on 31 July 2020, 12:00:08

Title: Focused/Unfocused events not working properly in 0.8.7
Post by: densm27 on 31 July 2020, 12:00:08
Hello texus & everyone.

I found what seems to be a regression in tgui.net in 0.8.7+ versions.
So, I take the example code from https://tgui.net/example-code/ (https://tgui.net/example-code/), and add focused/unfocused event handlers to the widgets:
Code: [Select]
editBoxUsername.Focused+= (sender, eventArgs) => Console.WriteLine("uname focused");
editBoxUsername.Unfocused+= (sender, eventArgs) => Console.WriteLine("uname unfocused");
editBoxPassword.Focused+= (sender, eventArgs) => Console.WriteLine("pass focused");
editBoxPassword.Unfocused+= (sender, eventArgs) => Console.WriteLine("pass unfocused");

After launching the app and clicking any of the widgets once, i get both focused and unfocused messages for the same widget immediately. Second click at the same element, or click outside of it does not trigger any events. Click on the other widget works the same as the first one, triggering both events for it simultaneously.

Downgrading to 0.8.6 nuget package fixes the issue, but unfortunately is not an option because of the checkbox/radiobutton creation bug present in that version.
Title: Re: Focused/Unfocused events not working properly in 0.8.7
Post by: texus on 31 July 2020, 12:49:59
I have patched the issue. There was a typo that caused the Unfocused handler to be connected to Focused callbacks instead of Unfocused callbacks.

There isn't a new nuget package yet, but you can download the up-to-date nightly build (https://github.com/texus/TGUI.Net/releases/tag/nightly_build) by clicking the following download link: TGUI.Net-0.8-dev-64bit.zip (https://github.com/texus/TGUI.Net/releases/download/nightly_build/TGUI.Net-0.8-dev-64bit.zip)
Title: Re: Focused/Unfocused events not working properly in 0.8.7
Post by: densm27 on 31 July 2020, 13:07:30
Cool, thanks!