tgui::EditBox signal on Unfocused

Started by Blaxxun, 19 November 2019, 19:57:37

Blaxxun

Hello forum,

I have an EditBox to enter color values from 0 to 255.

I need to check for correct value entry by the user which i can do with "ReturnKeyPressed".
But if the user just clicks outside the Box and it looses focus i dont have a signal.

Can this be done somehow?

"TextChanged" is not really helpful in my case.

Thanks!

texus

EditBox also has signals that it inherits from the Widget base class, the "Unfocused" signal is one of them.

Both can be connected at once to the same function like this:
Code (cpp) Select
edit->connect({"ReturnKeyPressed", "Unfocused"}, []{ });

Blaxxun

Hello texus,

thank you for the swift reply!!  :)

I knew that it inherits but wasnt able to find the available keywords/signal words.
Is there an overall info doc somewhere? I couldnt find anything.

Thanks!

texus

It's not easy to find, but there is a list of signals in the documentation. The available signals can be found under the Public Attributes section. There you can unfold the inherited properties to get a full list of all signals supported by the widget.

In TGUI 0.8.6 I also added a Signals namespace that can be used as alternative to using the strings. You can now use tgui::Signals::EditBox::ReturnKeyPressed instead of "ReturnKeyPressed", which means that auto-complete in an IDE might also give you a list of possible signals. The documentation of these structs also provide a list. I don't think the Signals namespace is mentioned in any tutorials yet, so it also easy to miss.

I always wanted to have a good overview of widgets somewhere, some place where it shows how every widget looks and what signals you can use etc, but I just don't have the time for it.

Blaxxun

Ah, okay,

i totally missed the fact that "Public Attrbutes inherited from" can actually be unfolded.  ::)

Thank you for this info and the new namespace alternative info.
I think, knowing this its okay without any further overview. :)

Thanks a lot! Its a great GUI!