Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Cheat Engine Forum Index
PostGo back to topic
Corroder
Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Feb 22, 2018 2:22 am    Post subject: Re: get mouse posistion x and y in a panel [ help ]

Lynxz Gaming wrote:
how to get mouse position or set position x and y
but in panel not in whole screen


Example : <copy and paste script below to CE Table and execute>

Code:
f = createForm()
f.width, f.height = 300,250
pnl = createPanel(f)
pnl.left,pnl.top = 10,10
pnl.width,pnl.height = 280,180
pnl.Caption = 'Panel for mouse pos action'

lblX = createLabel(f)
lblX.left, lblX.top = 10, pnl.top+pnl.height + 20
lblX.font.size = 14

lblY = createLabel(f)
lblY.left, lblY.top = lblX.left + lblX.width + 150, pnl.top+pnl.height + 20
lblY.font.size = 14

function pnlOnEnter()
 z=createTimer(nil)
 z.Interval=100
 z.OnTimer=function(z)
 local x,y = getMousePos()
 x,y = pnl.ScreenToClient(x,y)
 lblX.caption = 'X.pos : '..tostring(x)
 lblY.caption = 'Y.pos : '..tostring(y)
 return x > 0 and x < pnl.width and y > 0 and y < pnl.height
 end
  z.Enabled=true
 end

function pnlOnLeave()
 z.destroy()
 x,y = 0,0
 lblX.caption = 'X.pos : '..tostring(x)
 lblY.caption = 'Y.pos : '..tostring(y)
end

pnl.onMouseEnter = pnlOnEnter
pnl.onMouseLeave = pnlOnLeave

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
Oxijen
Review: Approve
Post reference:
ReviewPosted: Thu Sep 03, 2020 12:43 pm

Thx again and again!!
Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites