Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
62
Task/Mouse-position/Ring/mouse-position.ring
Normal file
62
Task/Mouse-position/Ring/mouse-position.ring
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
Load "guilib.ring"
|
||||
|
||||
lPress = false
|
||||
nX = 0
|
||||
nY = 0
|
||||
|
||||
new qApp {
|
||||
|
||||
win1 = new qWidget()
|
||||
{
|
||||
|
||||
setWindowTitle("Move this label!")
|
||||
setGeometry(100,100,400,400)
|
||||
setstylesheet("background-color:white;")
|
||||
|
||||
Label1 = new qLabel(Win1){
|
||||
setGeometry(100,100,200,50)
|
||||
setText("Welcome")
|
||||
setstylesheet("font-size: 30pt")
|
||||
myfilter = new qallevents(label1)
|
||||
myfilter.setEnterevent("pEnter()")
|
||||
myfilter.setLeaveevent("pLeave()")
|
||||
myfilter.setMouseButtonPressEvent("pPress()")
|
||||
myfilter.setMouseButtonReleaseEvent("pRelease()") myfilter.setMouseMoveEvent("pMove()")
|
||||
installeventfilter(myfilter)
|
||||
}
|
||||
|
||||
show()
|
||||
}
|
||||
|
||||
exec()
|
||||
}
|
||||
|
||||
Func pEnter
|
||||
Label1.setStyleSheet("background-color: purple; color:white;font-size: 30pt;")
|
||||
|
||||
Func pLeave
|
||||
Label1.setStyleSheet("background-color: white; color:black;font-size: 30pt;")
|
||||
|
||||
Func pPress
|
||||
lPress = True
|
||||
nX = myfilter.getglobalx()
|
||||
ny = myfilter.getglobaly()
|
||||
|
||||
Func pRelease
|
||||
lPress = False
|
||||
pEnter()
|
||||
|
||||
Func pMove
|
||||
nX2 = myfilter.getglobalx()
|
||||
ny2 = myfilter.getglobaly()
|
||||
ndiffx = nX2 - nX
|
||||
ndiffy = nY2 - nY
|
||||
if lPress
|
||||
Label1 {
|
||||
move(x()+ndiffx,y()+ndiffy)
|
||||
setStyleSheet("background-color: Green;
|
||||
color:white;font-size: 30pt;")
|
||||
nX = nX2
|
||||
ny = nY2
|
||||
}
|
||||
ok
|
||||
Loading…
Add table
Add a link
Reference in a new issue