Visual elements other than button seem to not be working for ClickEvent callbacks

This used to work for me but it doesn’t anymore in preview version 14. Am I going crazy?

rootVisualElement.Q(“label-line”, “loginScreen”)?.RegisterCallback(ev => CreateAccountLinkClick());

Any other way to get press events for other visual elements?

Thank you!

It works here. I’d double-check that the Q<> query doesn’t return null, otherwise the registration will be silently skipped because of the “?.”.

If it still fails, can you share a small project that shows the same behavior?

Thank you for the response! So far I have narrowed down the issue to how I am nesting each screen under a ‘screen manager’ UXML.

When I do that, the labels are visible but as if they don’t have ‘space’ to click. Going to try to see what I am doing wrong. I will post here when I solve for anyone else who might run into this.

Yes definitely a container (visual element) height issue. Forced the height with an inline setting and all good.

1 Like