Button not registering mouse up

0

Hello, i'm using both

// Filtered keys
bool OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) override;

and

// UI button action
void OnAction(AZ::EntityId entityId, const LyShine::ActionName & actionName) override;

to generate mouse input in my project but it seems that whenever i click on a UI button, filtered keys stop sending mouse button up events. No matter how many times i click on a button not even one mouse up event is generated but every time i click i get 2-5 mouse down events(i get 2-5 mouse down events even when clicking not on a button).

If i press a button, hover off the button and release mouse, up event is still not getting generated.

Moreover, button actions don't seem to provide functionality to know if mouse was released off it.

How do solve this?

Edit:

It seems

o_hasBeenConsumed = OnInputChannelEventFiltered(inputChannel);

consumes my mouse up events but not down events. In any case, the consuming of inputs in general is unwanted behavior as it corrupts behavior of any interactive elements i have.

asked 5 years ago182 views
4 Answers
0
Accepted Answer

Hi @REDACTEDUSER

Thanks for your question.

I'm not sure I understand exactly what it is that you are trying to do, but it sounds like you should either use LyShine to handle the inputs or the InputChannelEventListener but not a mixture of the two.

LyShine will consume mouse down events if you press the mouse while hovering over a button. Are you not seeing that happening?

Are you using C++, Lua or ScriptCanvas to write your interaction handling code?

The simplest thing, if you just want to get button clicks or press/release for buttons is to let LyShine handle it since that will do the work of knowing which button your are clicking on. You can either use action strings or notification buses such as UiButtonNotificationBus.

If, for some reason, you do not want LyShine to handle input you can disable that for a given UI canvas, either in the UI Editor canvas properties or via code/script.

Buttons are designed such that if you press down on a button but then move off the button and release then the click event is not sent. It looks like, in this case, it also doesn't send the released notification. Is this what is causing problems for you?

Rob

answered 5 years ago
0

Thanks for the reply. Unfortunately my canvas contains simple buttons and more complex elements (images which i manipulate myself) and using only LyShine is not sufficient.

Yes, mouse down events happen on lyshine but are not consumed, while mouse up events are consumed.

I am using c++.

Would you suggest using a few canvases at a time then to avoid clashes between LyShine and

InputChannelEventListener or would that cause more problems?

Edit: it seems that after i disabled and enabled "Handle positional" option on my canvas, mouse down events started getting consumed as well.

answered 5 years ago
0

Thank you @REDACTEDUSER

answered 5 years ago
0

Using multiple canvases is supported and can be a good solution in certain situations. I'm not sure if it makes sense in this case.

When you say it started working after disable/re-enable do you mean you did that in the UI editor and resaved the UI canvas?

answered 5 years ago

This post is closed: Adding new answers, comments, and votes is disabled.