ItemBox question

DragonM

08-09-2012 01:29:01

Is it possible for a widget included in an ItemBox item layout to receive mouse events? A button, for example. It appears the ItemBox processes all mouse input on itself, allowing nothing through to the widgets of individual items.

I suppose low-level processing of mouse activity on an ItemBox is possible, thereby emulating MyGUI's normal functioning. Is there a less "manual" way of achieving the same results?

Altren

08-09-2012 11:46:29

Actually this works by default. I guess, that your buttons are covered by transparent widget placed over buttons, that receive mouse events.

DragonM

09-09-2012 02:11:17

Actually this works by default. I guess, that your buttons are covered by transparent widget placed over buttons, that receive mouse events.
Indeed this does work. My error was in adapting the Item layout in the ItemBox sample without being careful. It has NeedMouse set to false on _Main. With that property removed, the button behaves normally.

Thank you.

DragonM

09-09-2012 02:58:21

So the next question is, is it possible for a subordinate widget to override the NeedMouse settings of its parent? ItemBox Items must have NeedMouse set to false to behave properly, but I would still like the child button to be mouse accessible. Setting NeedMouse false on the top level widget and NeedMouse to true on the button does not work.

Altren

10-09-2012 00:37:43

There is property called "InheritMousePick", or something like this. It allow you to make widget make mouse events go through it, but let child widgets receive them.

DragonM

10-09-2012 05:26:33

There is property called "InheritMousePick", or something like this. It allow you to make widget make mouse events go through it, but let child widgets receive them.
The property is InheritsPick and it does work.

It is also misnamed. In English, one inherits from one's parents, grandparents, greatgrandparents, etc. The name of the property implies it should be applied to the child, and that it should be False if one of the ancestor widgets has NeedMouse set to False.

The precise opposite is true. It should be applied to all ancestors that also have NeedMouse set to False and its value should be True. I found this in the code to understand how it works:
if (!mEnabled
|| !mVisible
|| (!getNeedMouseFocus() && !getInheritsPick())
|| !_checkPoint(_left, _top)
// если есть маска, проверяем еще и по маске
|| !isMaskPickInside(IntPoint(_left - mCoord.left, _top - mCoord.top), mCoord)
)
return nullptr;
(I am sure that code is not news to you. I quote it for the benefit of other people referring to the thread in the future.)

A name that correctly implies the function of the property would be PassThroughPick.

Thank you for your assistance. My ItemBox now behaves as I'd hoped.