im trying to make buttons for my phone program to launch apps all i have for it is a border around the screen
how would i add buttons to launch programs to it?
Buttons?
Started by Krul__Tepes, Jul 23 2017 11:27 AM
5 replies to this topic
#1
Posted 23 July 2017 - 11:27 AM
#2
Posted 23 July 2017 - 12:15 PM
it depends if you want gui buttons, you could use many different ways of this but one way is to do ex: paintutils.drawFilledBox(1, 1, 10, 19, colors.gray)
and from there you want an mouse click detection and mouse click position
ex:
and from there you want an mouse click detection and mouse click position
ex:
function click() --this function is for checking where and if clicked
event, button, x, y = os.pullEvent("mouse_click") --this will call the event with the variables button, x, y
if button == 1 then --if user click left click (2 is for right click and 3 is for middle click)
if x>=34 and x<= 45 and y == 3 then --check if x is more or equal to 34 and less or equal too 45 and Y is equal to 3 thats gonna be the area where the button is
shell.run("program to run here") --runs the program
end
end
end
Edited by danielsv03, 23 July 2017 - 12:17 PM.
#4
Posted 23 July 2017 - 05:24 PM
both these replies confuse me xD
well Danels makes sense but the 4th line
well Danels makes sense but the 4th line
#6
Posted 24 July 2017 - 08:21 AM
Krul__Tepes, on 23 July 2017 - 05:24 PM, said:
both these replies confuse me xD
well Danels makes sense but the 4th line
well Danels makes sense but the 4th line
a good way to do this is too tell it first: if x is more or equal to example 34 and x is less or equal too 50 this will keep it in between 34 and 50 as x
picture: ----->34 between 50<-----
and lastly the Y it tells if the y is ex on line 3 then continue if all those is correct.
Note: you can do the same with Y as with x
I tried to do my best explaining just ask if you have any questions
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











