Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Tue 11/06/2013 12:35:22

Title: [WORKING AS DESIGNED] "on_mouse_click" not called when clicking on gui?
Post by: Monsieur OUXX on Tue 11/06/2013 12:35:22
Hi all,

According to the manual :
Quoteon_mouse_click (MouseButton button)
Called when the player clicks a mouse button. BUTTON is either LEFT, RIGHT or MIDDLE, depending on which button was clicked. The "mouse.x" and "mouse.y" global variables contain the mouse's position.

It doesn't say anything specific about GUIs.
Yet, when I click on a GUI (it's "on" and "clickable"), then on_mouse_click is not called. When i click outside, it's called.
I don't understand why. As a workaround I call "IsButtonDown" in repeatedly_execute_always.
Title: Re: "on_mouse_click" not called when clicking on gui?
Post by: Calin Leafshade on Tue 11/06/2013 12:38:04
I agree, on_mouse_click should be called *every* time the mouse is clicked. It doesn't make any sense to stop it doing so over a GUI.
Title: Re: "on_mouse_click" not called when clicking on gui?
Post by: Khris on Tue 11/06/2013 13:14:50
I understand the reasoning, because in an adventure game, there aren't too much situations where you're dragging GUIs or stuff like that. 99,9% of the time, you're clicking on a GUI control or the room.
It might also have to do with the fact that AGS used to handle all GUI clicks in the interface_click function, and on_mouse_click was supposed to handle all other clicks.

There's also on_event / eEventGUIMouseDown/Up.
Title: Re: [WORKING AS DESIGNED] "on_mouse_click" not called when clicking on gui?
Post by: Monsieur OUXX on Tue 11/06/2013 18:59:19
O, thanks for the answers!