Jump to content




[Right new help request...] [right-click-menu]


  • You cannot reply to this topic
6 replies to this topic

#1 Goof

  • Members
  • 751 posts

Posted 04 January 2013 - 01:57 AM

Hello.

im trying to make a right click menu (popup) but i cant get it to work, when trying to detect if the mouse button is Right, or Left.

Does anyone know anything about right and left click detection?

i do not find any good tutorials on this, so thats because i posted this:

EDIT: i found a new issue...
when trying to leftclick at the Settings menu, it doesnt work... but it does work when clicking on the Stop menu.

newest code:

http://pastebin.com/NkHQBmwi





code:
Spoiler

thanks :)

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 04 January 2013 - 02:00 AM

The button is a number. 1 for left click, 2 for right, 3 for middle.

#3 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 04 January 2013 - 02:01 AM

button is 1, 2, or 3
1 is left click
2 is right
3 is middle

#4 Goof

  • Members
  • 751 posts

Posted 04 January 2013 - 02:07 AM

Thanks. :)




Look down...

#5 Goof

  • Members
  • 751 posts

Posted 04 January 2013 - 02:39 AM

Ehhm.. Im having another issue!


When left clicking on the "Settings", then it just doesnt work.. it only works when clicking on the "stop" menu... can you help..



thanks

#6 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 04 January 2013 - 03:18 AM

It's because of the if block within the second os.pullEvent()

As you can see that both the if and elseif have the same condition so the first one will always trigger.
               	 if x1 > (x+1) and x1 < (x+13) then
                        if y1 == (y+2) then                            
                            tB(colors.lightGray)
                            term.clear()
                            print("Choosen Stop")
                            sleep(3)
                            running = false
                        end                    
                    elseif x1 > (x+1) and x1 < (x+13) then
                        if y1 == (y+3) then                
                            tB(colors.lightGray)
                            term.clear()
                            print("Choosen Settings")
                            sleep(3)
                            term.setCursorPos(1,1)
                            running = false
                            shell.run("edit [email protected]")
                            running = true
                            tB(colors.lightGray)
                            term.clear()
                            term.setCursorPos(1,1)
                            print("Settings Saved.")
                            sleep(2)
                        end        
                    end

This works:

               	 if x1 > (x+1) and x1 < (x+13) and y1 == y+2 then                    
                            tB(colors.lightGray)
                            term.clear()
                            print("Choosen Stop")
                            sleep(3)
                            running = false                
                    elseif x1 > (x+1) and x1 < (x+13) and y1 == y+3 then    
                            tB(colors.lightGray)
                            term.clear()
                            print("Choosen Settings")
                            sleep(3)
                            term.setCursorPos(1,1)
                            running = false
                            shell.run("edit [email protected]")
                            running = true
                            tB(colors.lightGray)
                            term.clear()
                            term.setCursorPos(1,1)
                            print("Settings Saved.")
                            sleep(2)    
                    end


#7 Goof

  • Members
  • 751 posts

Posted 04 January 2013 - 04:15 AM

** Lol ** Thanks... how stupid could i just be there... :o

Now everything works fine :D

Thanks!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users