click behind button

nevarim

24-01-2017 22:39:52

hi all
is there a way to do a "mask" so if i click on a button there is no way that i click on terrain behind button?

thanks
Neva

Altren

25-01-2017 20:07:45

All MyGUI inject***functions return boolean variable, meaning that GUI handled event, so if inject mouseMove/Press/Release returned true you should not pass mouse event further into non-gui game controls. By default all widgets are not transparent to input, but if you need them to be use setNeedMouseFocus to false or use same property with the same name in LayoutEditor.

nevarim

27-01-2017 01:19:55

if you mean that if i set needmouse in layouteditor as false i can use a code as this below i tested it and when i tried i had result that all widget aren't able to click

if (MyGUI::InputManager::getInstance().injectMousePress(arg.state.X.abs, arg.state.Y.abs, MyGUI::MouseButton::Enum(id)) == true)
{
txt_write("you clicked inside");
}
else
{
txt_write("you clicked outside");
}

thanks for help
Neva

Altren

29-01-2017 15:22:13

All widgets react on mouse input by default, so to make gui "transparent" for mouse you need to set NeedMouse for all underlying widgets as well.
Edit: I misunderstood you. If you have Some widget that should be transparent to mouse with child widgets that should react on mouse and be not transparent set NeedMouse to false and InheritsPick to true for transparent widgets and keep default settings for other widgets. Setting NeedMouse to false for root widget make all it's childs ignore mouse as well, unless you set InheritsPick.