BBC BASIC for Windows
« Using the Mouse »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Using the Mouse  (Read 431 times)
basscott
New Member
Image


member is offline

Avatar




PM


Posts: 5
xx Using the Mouse
« Thread started on: Oct 7th, 2015, 08:51am »

I am new to BBC Basic and have an issue using the mouse.

I use the following to get the co-ordinates when I click the mouse and this works OK: -

REPEAT
MOUSE X,Y,BUTTON%
UNTIL BUTTON%

I then use X and Y to determine where in the window the mouse is pointing to in order to carry out some simple code - I then go to another part of the program where I repeat the above code to get a 2nd location when I click the mouse.

The issue I have is that the values of X and Y remain the same as the first click and don't seem to get overwritten by the details from the 2nd click; in fact the program doesn't seem to wait for the mouse to be clicked on the 2nd occasion.

I'm probably misunderstanding the way that this functionality works - any help please ?
User IP Logged

basscott
New Member
Image


member is offline

Avatar




PM


Posts: 5
xx Re: Using the Mouse
« Reply #1 on: Oct 7th, 2015, 08:53am »

that should be : -

UNTIL BUTTON%<>0
User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: Using the Mouse
« Reply #2 on: Oct 7th, 2015, 09:34am »

Hi Basscott,

I think the problem is that there are usually a stream of responses sitting in the mouse buffer (usually about half a dozen or so from a single click). I usually end any mouse-handling routine with...
Code:
REPEAT MOUSE x%,y%,z%
UNTIL z%=0
 

...which empties the buffer.
Hope that helps!

D
User IP Logged

number6
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 2
xx Re: Using the Mouse
« Reply #3 on: Oct 7th, 2015, 11:07am »

Hi basscott
Thanks for asking that particular question and thanks also to DDRM for his reply. I had a similar problem and DDRM's solution is exactly what was needed.!
« Last Edit: Oct 7th, 2015, 11:08am by number6 » User IP Logged

Be seeing you
basscott
New Member
Image


member is offline

Avatar




PM


Posts: 5
xx Re: Using the Mouse
« Reply #4 on: Oct 7th, 2015, 2:49pm »

Perfect - resolved the issue completely.

Thanks a lot - saved my sanity.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls