[R168] Mouse event On Left button Clicked on Buttons bug

0 favourites
  • 4 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games. With wood, nature, & jungle theme
  • Problem Description

    I have a problem with Mouse event On Left button Clicked and Buttons which doesn't work. What is more interesting, Mouse event On Double-Clicked with buttons works!

    I'm not exactly sure is it a bug a not, but I can't find any information about my issue anywhere and it can be seen that in previous versions of Construct 2 (i.e. in section The Event Sheet) Mouse event On Left button Clicked on Button worked.

    Attach a Capx

    Example file is attachment to this post.

    Description of Capx

    On presented layout four things can be seen:

    -textbox - here all debug texts are written,

    -button #1 [Mouse on click] - it has event Mouse On Left button Clicked and it should set a text to textbox but it doesn't,

    -button #2 [Button on click] - it has event Button On clicked, it sets a text to textbox without problem,

    -sprite - it has event Mouse On Left button Clicked and it sets a text to textbox without problem.

    Why sprite with Mouse On Left button Clicked event works and button #1 with the same event doesn't?

    Steps to Reproduce Bug

    • Create a new project.
    • Double click on Layout and place a new object - button.
    • Double click on Layout and place a new object - textbox.
    • Double click on Layout and place a new object - Mouse.
    • Go to Event sheet and add event for Mouse On Left button Clicked on Button and as an action select Textbox and Set Text property with any text value.
    • Run an application and click on button which won't work.

    Observed Result

    Button with Mouse event on left button clicked doesn't work.

    Expected Result

    After left click button, text box should be filled with text.

    Affected Browsers

    • Chrome: Yes
    • FireFox: Yes
    • Internet Explorer: Yes

    Operating System and Service Pack

    Windows 8.1

    Construct 2 Version ID

    R168

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I noticed something similar with my own project and I believe you are correct. However, I'm not sure why you would need to detect whether or not the mouse has clicked the button. Shouldn't you simply be testing in an event whether or not the button has been clicked regardless of mouse?

    Though I must say having an event I can use as a "while button down" would be really handy, because I have a "block" feature in my game that is supposed to occur while a button is being held down, but there are no events for that (that I've been able to find, anyway) so I have used instead a custom sprite object as a button.

  • Of course you are right about using Button On clicked rather then Mouse On left button Clicked on Object especially when 2nd one doesn't work . But questions are: why does dbl click work for 2nd event and why at the same time single click works for sprite but doesn't work for button - so what is wrong with Mouse On left button Clicked on Object and Buttons?

    About your off-topic: (remember that I'm a new one with C2 and I can be wrong) did you try events Mouse Cursor is over object (Button) AND Mouse button is down in single condition? I'm only guessing it could work.

  • Closing as won't fix: button objects are form controls that float above the canvas, and handle mouse events separately, so you need to use the 'Button clicked' trigger rather than the Mouse object. It's a minor quirk. I don't know why double clicking would be different.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)