Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 The right and left click buttons
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chalcids




PostPosted: Wed May 30, 2012 7:19 am   Post subject: The right and left click buttons

I want to write a morse code program so when i right click a dash appears and when i left click i get a dot and the well the space bar does a space. I want it to type out messages. Is this possible?
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Wed May 30, 2012 9:44 am   Post subject: RE:The right and left click buttons

You can look into the Mouse module in the documentation.
Aange10




PostPosted: Wed May 30, 2012 10:16 am   Post subject: RE:The right and left click buttons

It is indeed very possible.
Raknarg




PostPosted: Wed May 30, 2012 12:50 pm   Post subject: RE:The right and left click buttons

actually, just to make it simple:

var mx, my, mb : int

Mouse.Where (mx, my, mb)

When you use this code, the procedure will take in three variable and return the mouse's current status. Respectively the x position, y position relative to the screen, and the current button being pressed (0 for none, 1 for left, 10 for middle wheel and 100 for right, I believe)
chalcids




PostPosted: Wed May 30, 2012 12:53 pm   Post subject: Re: The right and left click buttons

but what does have to do with the buttons i want it to when i left click in the program to put a dot on the line on the screen like morse code
Tony




PostPosted: Wed May 30, 2012 1:28 pm   Post subject: Re: The right and left click buttons

It has to do with the
chalcids @ Wed May 30, 2012 12:53 pm wrote:
i left click

part.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chalcids




PostPosted: Wed May 30, 2012 1:47 pm   Post subject: Re: The right and left click buttons

like what is wrong with that part like is there not a button command for that at all
Tony




PostPosted: Wed May 30, 2012 2:57 pm   Post subject: RE:The right and left click buttons

That sentence was terrible. Were you trying to ask a question?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
chalcids




PostPosted: Wed May 30, 2012 3:18 pm   Post subject: Re: The right and left click buttons

i want to know how to use the mouse buttons ie the left click, scroll and right button to do something like when i left click a dot appears when i scroll a space appears and when i right click a - appears.
Tony




PostPosted: Wed May 30, 2012 4:20 pm   Post subject: RE:The right and left click buttons

Something like
code:

loop
   get_click_states
   if ( click_states include left_click) then
      draw_dot
   end if
end loop
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chalcids




PostPosted: Wed May 30, 2012 5:23 pm   Post subject: Re: The right and left click buttons

yeah do you the rest of the code because it says i need to declare some variables?
Aange10




PostPosted: Wed May 30, 2012 5:44 pm   Post subject: Re: The right and left click buttons

chalcids @ 30/5/2012, 4:23 pm wrote:
yeah do you the rest of the code because it says i need to declare some variables?


You need to do the code yourself.

They told you that if you put in three variables to Mouse.Where() that is will respectively output the X,Y, and button states of the mouse.

You were also told that if the button state was 0 then nothing was being pressed, if the state was 1 that it was being left click, if the state was 10 it was being middle clicked, and if the state was 100 it was being right clicked.

So what you've learned:
- How to get the X position of the mouse.
- How to get the Y position of the mouse.
- How to see which button is being pressed.


Now YOU right the code, and if you get stuck we can help. But stuck doesn't mean "Okay I know what i want to do, now tell me how to do everything I don't have."
chalcids




PostPosted: Wed May 30, 2012 5:48 pm   Post subject: Re: The right and left click buttons

But why do i need that
Tony gave me what i wanted i just to know how to declare the variables he used.
Tony




PostPosted: Wed May 30, 2012 5:57 pm   Post subject: RE:The right and left click buttons

in case that wasn't obvious, none of what I posted was supposed to be working code; it just resembles code to help you read and inspire ideas for how to approach the problem.

You can't just copy-paste blocks of code together, it will not work. Among other reasons, it's an infinite loop and will never give up control to any of the other code you end up pasting in.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Luffy123




PostPosted: Wed May 30, 2012 5:57 pm   Post subject: Re: The right and left click buttons

chalcids @ Wed May 30, 2012 5:48 pm wrote:
But why do i need that
Tony gave me what i wanted i just to know how to declare the variables he used.


He didn't give you anything. Just showed you the format it should be in.

Mouse.Where returns the button that is clicked.

So you should know what you have to do from there. Check what button was clicked and do what you want to do with it.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 23 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: