Mouse Button Down - Inoperable!

Get help using Construct 2

Post » Tue Jul 01, 2014 12:49 am

Hi all,

I've discovered that the check for a mouse button down condition... fails if the pointer is over an object.

Example... if the mouse is down whilst on a slider. I had a great solution to a problem... until I found this issue.

Does anyone know a way to detect if the mouse button is down, whilst on a slider (or button, or whatever).... OR... is it possible to do a test on the slider... to see if the control is currently being used? Either should work.

Thanks!

R
B
3
Posts: 8
Reputation: 189

Post » Tue Jul 01, 2014 1:12 am

You can use a drag and drop behavior on the slider object and limiting it's movement to only the slider.
B
6
S
1
Posts: 73
Reputation: 571

Post » Tue Jul 01, 2014 1:35 am

rezagamertag wrote:You can use a drag and drop behavior on the slider object and limiting it's movement to only the slider.


I'm very sorry, but I don't understand at all. I see the DragDrop behavior... but I don't see how to relate that to your suggestion. Could you be more specific?

Thank you for your kind help

R
B
3
Posts: 8
Reputation: 189

Post » Tue Jul 01, 2014 1:34 pm

You can try either putting an "every tick" "sliderobject.y = 100" while dragging.
Which will make the object stay in place.
And if it reaches beyond the slider itself you use the x value to keep it at the end.
"if sliderobject.x = more than 10" "make sliderobejct.x = 10"
"if sliderobject.x = less than 0" "make sliderobject.x = 0"
This will keep the sliderobject.x in between 0 and 10 while you're dragging and always on 100y.

I hope this made sense and it helps you understand how it might work.
B
6
S
1
Posts: 73
Reputation: 571

Post » Wed Jul 02, 2014 3:10 am

rezagamertag wrote:You can try either putting an "every tick" "sliderobject.y = 100" while dragging.
Which will make the object stay in place.
And if it reaches beyond the slider itself you use the x value to keep it at the end.
"if sliderobject.x = more than 10" "make sliderobejct.x = 10"
"if sliderobject.x = less than 0" "make sliderobject.x = 0"
This will keep the sliderobject.x in between 0 and 10 while you're dragging and always on 100y.

I hope this made sense and it helps you understand how it might work.


Well, not really... but I am trying.

This code seems to be all about moving the slider *object* (as opposed to the slider handle) around.

I have no interest in moving the slider object anywhere, so I am not sure how any of this helps.

Now, on the other hand, I DO want to move the slider handle left and right... as designed. And it does that... so no biggie.

But nowhere in this discussion do I see how to detect that the LMB is down.

How does the above suggestion tell me that the LMB is down?
B
3
Posts: 8
Reputation: 189

Post » Wed Jul 02, 2014 7:05 am

Ryder wrote:
rezagamertag wrote:You can try either putting an "every tick" "sliderobject.y = 100" while dragging.
Which will make the object stay in place.
And if it reaches beyond the slider itself you use the x value to keep it at the end.
"if sliderobject.x = more than 10" "make sliderobejct.x = 10"
"if sliderobject.x = less than 0" "make sliderobject.x = 0"
This will keep the sliderobject.x in between 0 and 10 while you're dragging and always on 100y.

I hope this made sense and it helps you understand how it might work.


Well, not really... but I am trying.

This code seems to be all about moving the slider *object* (as opposed to the slider handle) around.

I have no interest in moving the slider object anywhere, so I am not sure how any of this helps.

Now, on the other hand, I DO want to move the slider handle left and right... as designed. And it does that... so no biggie.

But nowhere in this discussion do I see how to detect that the LMB is down.

How does the above suggestion tell me that the LMB is down?


After you've added the mouse object to your project on the layout, just like you would add a new sprite, you go to your events.
And input this condition: "Mouse > Mouse button is down > Left"
B
6
S
1
Posts: 73
Reputation: 571

Post » Wed Jul 02, 2014 2:17 pm

rezagamertag wrote:
Ryder wrote:
rezagamertag wrote:You can try either putting an "every tick" "sliderobject.y = 100" while dragging.
Which will make the object stay in place.
And if it reaches beyond the slider itself you use the x value to keep it at the end.
"if sliderobject.x = more than 10" "make sliderobejct.x = 10"
"if sliderobject.x = less than 0" "make sliderobject.x = 0"
This will keep the sliderobject.x in between 0 and 10 while you're dragging and always on 100y.

I hope this made sense and it helps you understand how it might work.


Well, not really... but I am trying.

This code seems to be all about moving the slider *object* (as opposed to the slider handle) around.

I have no interest in moving the slider object anywhere, so I am not sure how any of this helps.

Now, on the other hand, I DO want to move the slider handle left and right... as designed. And it does that... so no biggie.

But nowhere in this discussion do I see how to detect that the LMB is down.

How does the above suggestion tell me that the LMB is down?


After you've added the mouse object to your project on the layout, just like you would add a new sprite, you go to your events.
And input this condition: "Mouse > Mouse button is down > Left"


Yes, and I've done that from the very start. What I reported with the OP, is that this the Mouse Button is Down fails to function properly, when the pointer is over a control.

Try it for yourself. If you go over a control, and hold LMB, Mouse Button Down will not register it. It literally can not see that in fact the mouse button is being held down.

At least, that is what I am seeing here.

Are you able to verify this?
B
3
Posts: 8
Reputation: 189

Post » Wed Jul 02, 2014 4:37 pm

Try it for yourself. If you go over a control, and hold LMB, Mouse Button Down will not register it. It literally can not see that in fact the mouse button is being held down.

At least, that is what I am seeing here.

Are you able to verify this?


What do you mean "mouse over a control"?
Can you upload a capx of this?
B
6
S
1
Posts: 73
Reputation: 571

Post » Wed Jul 09, 2014 9:51 am

Well I also discovered same,

Keep your mouse down on slidebar object and use every tick & mouse down in condition and print somewhere mouse.x and mouse.y or whatever you want.

It will never work,
Image
B
47
S
11
G
1
Posts: 254
Reputation: 4,251

Post » Thu Aug 07, 2014 1:17 am

rezagamertag wrote:
Try it for yourself. If you go over a control, and hold LMB, Mouse Button Down will not register it. It literally can not see that in fact the mouse button is being held down.

At least, that is what I am seeing here.

Are you able to verify this?


What do you mean "mouse over a control"?
Can you upload a capx of this?


This means, put the mouse pointer directly over a control, as if you plan to use it. Just like when you click your "submit" button to post a message... you have always moused over the "Submit" button with your pointer, yes? The press your left mouse button.
B
3
Posts: 8
Reputation: 189


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests