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 


Help! trackbar adjustment

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

Joined: 30 Dec 2023
Posts: 26

PostPosted: Sat Dec 30, 2023 12:39 am    Post subject: Help! trackbar adjustment Reply with quote

Can someone help me how to code to adjust trackbar by using textbox?
Thanks
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Sat Dec 30, 2023 10:39 am    Post subject: Reply with quote

This will do the trick:
Code:

if f then f.destroy(); f = nil end
f = createForm(getMainForm())
f.Name = 'frmMain'
f.Caption = 'Main Form'
f.Width = 300
f.Height = 275
f.Position = 'poDesktopCenter'

--------------------------------

local tb = createTrackBar(f)
tb.Name = 'tb'
tb.Width = f.Width - 25
tb.Height = 25
tb.Left = (f.Width - tb.Width) / 3
tb.Top = (f.Height - tb.Height) / 3
tb.Max = 100
tb.Min = 1
tb.OnChange = function(sender)
                f.ef.Text = tostring(sender.Position)
              end

local ef = createEdit(f)
ef.Name = 'ef'
ef.Text = '1'
ef.Left = 10
ef.Top = 10
ef.Width = f.Width - 20
ef.NumbersOnly = true
ef.OnChange = function(sender)
                         local pos = tonumber(sender.Text)
                         if pos < tb.Min or pos > tb.Max then return end
                         tb.Position = pos
                       end

Back to top
View user's profile Send private message
dan013
Cheater
Reputation: 0

Joined: 30 Dec 2023
Posts: 26

PostPosted: Sat Dec 30, 2023 11:17 am    Post subject: Reply with quote

LeFiXER wrote:
This will do the trick:
Code:

if f then f.destroy(); f = nil end
f = createForm(getMainForm())
f.Name = 'frmMain'
f.Caption = 'Main Form'
f.Width = 300
f.Height = 275
f.Position = 'poDesktopCenter'

--------------------------------

local tb = createTrackBar(f)
tb.Name = 'tb'
tb.Width = f.Width - 25
tb.Height = 25
tb.Left = (f.Width - tb.Width) / 3
tb.Top = (f.Height - tb.Height) / 3
tb.Max = 100
tb.Min = 1
tb.OnChange = function(sender)
                f.ef.Text = tostring(sender.Position)
              end

local ef = createEdit(f)
ef.Name = 'ef'
ef.Text = '1'
ef.Left = 10
ef.Top = 10
ef.Width = f.Width - 20
ef.NumbersOnly = true
ef.OnChange = function(sender)
                         local pos = tonumber(sender.Text)
                         if pos < tb.Min or pos > tb.Max then return end
                         tb.Position = pos
                       end



Thank you very much. This will help me alot
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Sat Dec 30, 2023 11:38 am    Post subject: Reply with quote

dan013 wrote:

Thank you very much. This will help me alot


You're welcome Smile.
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