TGUI Forum

General Category => Help requests => Topic started by: nolimitee on 06 March 2019, 15:18:08

Title: Set widget to unclickable
Post by: nolimitee on 06 March 2019, 15:18:08
Hello everyone,

How can I make a widget unclickable (e.g. with a tgui::Label) ? And by that, I mean tgui::handleEvent() stops returning me true when I click/hover to the widget.
I tried with ignoreMouseEvents(), but the tgui::handleEvent() keeps returning me true.
 
Thanks
Title: Re: Set widget to unclickable
Post by: texus on 06 March 2019, 20:01:46
It seems like ignoreMouseEvents doesn't do anything at all for Label, the property was added in both Label and Picture but is only used in Picture. I'll fix this soon.
Although handleEvent should return false after I fix it (unless there is another widget behind the label), what you need is the setEnabled function.

ignoreMouseEvents was added to allow a mouse event to reach the widget behind the label or picture, but to make a widget (any widget) completely ignore events, you should disable it:
Code: (cpp) [Select]
label->setEnabled(false);
Title: Re: Set widget to unclickable
Post by: nolimitee on 06 March 2019, 21:03:28
Oh okay, I understand.
Indeed, it works with setEnabled, thanks for your answer !