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 


get mouse posistion x and y in a panel [ help ]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Lynxz Gaming
Advanced Cheater
Reputation: 1

Joined: 01 Jul 2017
Posts: 64

PostPosted: Thu Feb 22, 2018 12:26 am    Post subject: get mouse posistion x and y in a panel [ help ] Reply with quote

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

thx for reply
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 353

Joined: 09 May 2003
Posts: 20599
Location: The netherlands

PostPosted: Thu Feb 22, 2018 12:45 am    Post subject: Reply with quote

use control.screenToClient/clientToScreen to concert x,y coordinates between the two
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

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

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

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
Lynxz Gaming
Advanced Cheater
Reputation: 1

Joined: 01 Jul 2017
Posts: 64

PostPosted: Thu Feb 22, 2018 4:45 am    Post subject: This post has 1 review(s) Reply with quote

thank you again corroder and db!
it works
Back to top
View user's profile Send private message
MateeJr Gaming
Cheater
Reputation: 0

Joined: 24 Dec 2017
Posts: 41

PostPosted: Thu Feb 22, 2018 5:35 am    Post subject: Reply with quote

Lol lynxz ini aku
_________________
MateeJr Gaming
MASTERCHEATER
:v
subs MateeJr Gaming
Lynxz Gaming
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites