Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Help with Pressing Button plz

Author
Message
Q and A but mostly Q
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location:
Posted: 7th Sep 2008 20:17
My problem is when I press my mouse button over a button I want it to register as it being clicked but just once at the click not the press. So when I Click and hold my mouse button it will only register the button being pressed once and at the start of the click of the mouse button.

I got that to work but what is happening when I dont click on the button and click sumwhere else on the screen then hold the mouse button down and drag the cursor over the button on the screen it will still click the button. I want it to only click if the mouse is already scrolled over it. Here is an example of my code so far.




So as you can see if you scroll over the button Game it turns Green then if you click it, hello appears. Now if you click somewhere else on the screen and then drag the mouse over the Game button it will still print hello world. I dont want it to do that I only want it to print Hello if the mouse cursor is already over the button and then pressed.

I tried lots of different ways to get it to work but maybe I am just going about it wrong, Please take a look at my code, any help is greatly appreciated. Thanks!
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 7th Sep 2008 21:41 Edited at: 7th Sep 2008 21:44
Try this:



I hope its what you want.


Whatever...
Q and A but mostly Q
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location:
Posted: 7th Sep 2008 22:04
Wow thanks a billion! Thats exactly what I wanted!
Frans
16
Years of Service
User Offline
Joined: 12th Sep 2008
Location: Netherlands
Posted: 18th Sep 2008 16:54
Hi,

This is exactly what I'm looking for at this moment.

I am trying to understand what's happening in this fine working code.
Am confused though between BP and PB.

If one of you two people would be so kind ..

Thanks
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 19th Sep 2008 05:06
@Frans:

I am not good at writing explanations(or tutorials), but take a look at this:



It's the same thing, but, with different variable names. The subject you are looking for is "variable scope". I suggest that you go through TDK's tutorials.

Look here:
http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

I hope this helps.


Whatever...
Frans
16
Years of Service
User Offline
Joined: 12th Sep 2008
Location: Netherlands
Posted: 19th Sep 2008 12:54
Dabbler thank you for the updated listing.

Together with the link you provided with the explanation about variable-scope, made me understand it.

Many thanks of course to Q & A who started this thread and came up with the original and questions (which exactly matched my problem).

Greetings!

Login to post a reply

Server time is: 2024-11-15 22:15:47
Your offset time is: 2024-11-15 22:15:47