Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25857 Location: The netherlands
|
Posted: Thu Apr 30, 2020 5:31 am Post subject: |
|
|
here's an example with a panel. It has a MouseDown, MouseMove and a MouseUp event
| Code: |
function UDF1_CEPanel1MouseDown(sender, button, x, y)
moving=true
--print("start moving")
start={}
start.x,start.y=sender.clientToScreen(x,y)
start.relx=x
start.rely=y
end
function UDF1_CEPanel1MouseMove(sender, x, y)
if moving then
local cx,cy=sender.clientToScreen(x,y)
local px,py=sender.parent.ScreenToClient(cx,cy)
local newx,newy
newx=px-start.relx
newy=py-start.rely
--print(string.format("%d,%d", newx,newy))
sender.Left=newx
sender.Top=newy
end
end
function UDF1_CEPanel1MouseUp(sender, button, x, y)
moving=false
--print("stop moving")
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|