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 


Imitating scrollbar behaviour

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Jane
Expert Cheater
Reputation: 0

Joined: 21 Feb 2016
Posts: 107

PostPosted: Fri Mar 10, 2017 10:22 am    Post subject: Imitating scrollbar behaviour Reply with quote

Going to continue this topic from here: http://fearlessrevolution.com/viewtopic.php?f=14&p=1078#p1078 since I don't think fearless will be very active now that CEF is back up.

Also thank you to @Corroder for your example, but I have no idea what Corona Labs is so I don't think I'll be able to utilize it.
Back to top
View user's profile Send private message
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 416

PostPosted: Fri Mar 10, 2017 10:56 pm    Post subject: Reply with quote

Maybe this :

Code:
local f = createForm()
f.Height = 300
f.Width = 300

object = createPanel(f)
object.Height = 100
object.Width = 100
object.Top = (f.Height - object.Height) / 2
object.Left = (f.Width - object.Width) / 2
object.Color = '0x00DD0FF'

b1 = createButton(f)
b1.Left = 10
b1.Top = 40
b1.Width = 30
b1.Height = 25
b1.Caption = 'L'
b1.Name = 'scrollLeft'

b2 = createButton(f)
b2.Left = b1.Left + b1.Width + 3
b2.Top = 40
b2.Width = 30
b2.Height = 25
b2.Caption = 'R'
b2.Name = 'scrollRight'

b3 = createButton(f)
b3.Width = 30
b3.Left = (b1.Left + b1.Width + b3.Width) / 2 - 5
b3.Top = 12
b3.Height = 25
b3.Caption = 'U'
b3.Name = 'scrollUp'

b4 = createButton(f)
b4.Width = 30
b4.Left = (b1.Left + b1.Width + b4.Width) / 2 - 5
b4.Top = b1.Top + b1.Height + 3
b4.Height = 25
b4.Caption = 'D'
b4.Name = 'scrollDown'

local Space = 23

local function scroll1(sender)
 if sender.Name == 'scrollLeft' then
 Speed = -10
 else
 Speed = 10
 end
 start = object.Left + Speed
 object.Left = start
end

local function scroll2(sender)
 if sender.Name == 'scrollUp' then
 Speed = -10
 else
 Speed = 10
 end
 start = object.Top + Speed
 object.Top = start
end

b1.onMouseDown = scroll1
b2.onMouseDown = scroll1
b3.onMouseDown = scroll2
b4.onMouseDown = scroll2


+ Define dragging area limit with custom condition if needed.
I don't know how to make custom function to simulate 'mouseDown until release' which need to repeat scrolling process. Maybe using timer or defines mouseDown and hold function first.


EDIT :

Another sample [Dragging Object] using mouse coordinat ( not perfect but just for starting to make it better )

Code:
f = createForm()
object = createPanel(f)
object.width = 30
object.height = 30
object.color = '0x00DD0FF0'
object.Left = 10
object.Top = 10

function drag(sender)
x = object.Left
y = object.Top
setMousePos({x=0,y=0})
object.Left = x
object.Top = y
z=createTimer(nil)
z.Interval=100
z.OnTimer=function(z)
local x, y = getMousePos()
object.Left = x
object.Top = y
end
z.Enabled=true
end

function undrag()
 z.Enabled = false
 z.destroy()
end

object.onMouseDown = drag
object.onMouseUp = undrag
Back to top
View user's profile Send private message
Jane
Expert Cheater
Reputation: 0

Joined: 21 Feb 2016
Posts: 107

PostPosted: Sat Mar 11, 2017 8:42 am    Post subject: Reply with quote

Thanks that second example is a little closer to what I needed, going to play with it for a while and see if I can adapt it to my original
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