Mouse CLiCK
Author |
Message |
coolest35
![](http://www.betterden.com/sport/team/tm118imga.jpg)
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
McKenzie
![](http://www.wizards.com/global/images/swtcg_article_27_pic3_en.gif)
|
Posted: Tue Dec 02, 2003 9:55 pm Post subject: (No subject) |
|
|
Clicking on a grid is a little easier. For your BS you could have basically used:
x:=(mnpx-160) div 40 + 2
y:=(mnpy-159) div 40 + 1
When you are clicking on a button (and not using the GUI) your need to check 5 things
mouseBtn = 1 and mouseX >= buttonX and mouseX <= buttonX + width and mouseY >= buttonY and mouseY <= buttonY + height |
|
|
|
|
![](images/spacer.gif) |
coolest35
![](http://www.betterden.com/sport/team/tm118imga.jpg)
|
Posted: Tue Dec 02, 2003 11:35 pm Post subject: what ? ?? |
|
|
i don't under stand that 1 bit.. if anyone has other ways that this can be.. done.. plz post them.. thnx ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed Dec 03, 2003 12:41 am Post subject: (No subject) |
|
|
eh... another way of doing it would be to grab your X/Y values... and then just figure out what cell its clicked on. Easiest example would be if grid starts at 0,0 and each cell is 10 pixels wide.
code: |
%get x/y values
%row is y/10
%column is x/10
cell(x/10,y/10) = true
|
or something... basically figure out what part of the grid is being clicked. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
McKenzie
![](http://www.wizards.com/global/images/swtcg_article_27_pic3_en.gif)
|
Posted: Wed Dec 03, 2003 12:58 am Post subject: Re: Mouse CLiCK |
|
|
coolest35 wrote: code: | now i have another assignment :oops: where i need buttons, |
When you say buttons, do you mean that you are clicking on a box to do something? Something like:
code: | var mx,my,mb:int
% the button
drawfillbox(50,60,90,80,green)
loop
mousewhere(mx,my,mb)
if mb =1 and mx > 50 and my > 60 and mx < 90 and my < 80 then
put "The green button"
end if
end loop |
|
|
|
|
|
![](images/spacer.gif) |
coolest35
![](http://www.betterden.com/sport/team/tm118imga.jpg)
|
Posted: Thu Dec 04, 2003 7:12 pm Post subject: Yep |
|
|
Hi, i need to make a GUI Button for the following : LOAD DATA FROM KEYBOARD, LOAD DATA FROM A FILE, SHOW DATA, SHOW MOST EXPENSIVE, SHOW LEAST EXPENSIVE, SHOW AVERAGE PRICE, SHOW OUT OF STOCK, SHOW TOTAL WORTH, EXIT. How would i make them into GUI buttons.. the turing reference doesn't give me a clue.... thnx |
|
|
|
|
![](images/spacer.gif) |
|
|