Should the button consume mouse events?

Right now, my scroll bar consists of 3 buttons (her children). Buttons currently consume the mouse, up, click and drag. The scroll bar then intercepts these 3 buttons and does what it wants to do from them. Therefore, in this scenario, I am not using the new bubble-up-stop feature of my GUI.

I still do not quite understand when I should use this, and when I should listen to child events.

Is my current technique a good way to do this, or will my button instead not use these events and receive events destined for the buttons and do things based on this?

thanks

+4
source share
1 answer

In this case, the 3 buttons (I assume up, down and slider) do not have enough information to do anything on their own; the best they can do is interact with the main scroll control and say what changes it should make. In this case, it might just be cleaner for the scrollbar to do all the message processing. He already needs to deal with things like arrow keys, right?

+1
source

Source: https://habr.com/ru/post/1347460/


All Articles