Set widget to unclickable

Started by nolimitee, 06 March 2019, 15:18:08

nolimitee

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

texus

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);

nolimitee

Oh okay, I understand.
Indeed, it works with setEnabled, thanks for your answer !