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

Bugs will be moved here once resolved.

Post » Thu May 15, 2014 4:31 pm

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
You do not have the required permissions to view the files attached to this post.
B
5
S
1
Posts: 7
Reputation: 289

Post » Thu May 15, 2014 4:35 pm

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.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,816

Post » Thu May 15, 2014 5:40 pm

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.
B
5
S
1
Posts: 7
Reputation: 289

Post » Tue May 20, 2014 12:12 pm

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.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,226


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest