View previous topic :: View next topic |
Author |
Message |
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Thu Feb 22, 2018 12:26 am Post subject: get mouse posistion x and y in a panel [ help ] |
|
|
how to get mouse position or set position x and y
but in panel not in whole screen
thx for reply
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Feb 22, 2018 12:45 am Post subject: |
|
|
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.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: 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 |
|
|
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Thu Feb 22, 2018 4:45 am Post subject: |
|
|
thank you again corroder and db!
it works
|
|
Back to top |
|
|
MateeJr GT Advanced Cheater Reputation: 0
Joined: 24 Dec 2017 Posts: 66
|
Posted: Thu Feb 22, 2018 5:35 am Post subject: |
|
|
Lol lynxz ini aku
_________________
Hi Lynxz Gaming |
|
Back to top |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Thu Sep 03, 2020 1:02 pm Post subject: Re: get mouse posistion x and y in a panel [ help ] |
|
|
2years !!
anyways
Corroder wrote: |
return x > 0 and x < pnl.width and y > 0 and y < pnl.height
|
what is this line performing??
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Fri Sep 04, 2020 2:28 am Post subject: |
|
|
oh ok, but I don't think it helps in this code, since it returns to pnlonenter, and you can hold left mouse down when your on panel and drag it.
anyways, thx for help!!
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Fri Sep 04, 2020 9:31 am Post subject: |
|
|
If you fully understand the 'return'' statement, then you will know, how that return command on that function is needed.
"A return statement returns occasional results from a function or simply finishes a function. There is an implicit return at the end of any function.
So you do not need to use one if your function ends naturally, without returning any value.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|