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 


How do I adjust the control hierarchy

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

Joined: 22 Jan 2019
Posts: 183

PostPosted: Tue Jun 25, 2024 12:15 am    Post subject: How do I adjust the control hierarchy Reply with quote

As shown, the label is blocked by the progressbar. How do I adjust it if I want the label to be displayed on top of it :cry:


Screenshot_2024-06-25-14-12-49-72_2665fb67b16260a8d818298cef8dc107.jpg
 Description:
 Filesize:  350.98 KB
 Viewed:  2492 Time(s)

Screenshot_2024-06-25-14-12-49-72_2665fb67b16260a8d818298cef8dc107.jpg


Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1528

PostPosted: Tue Jun 25, 2024 4:59 pm    Post subject: Reply with quote

For now this doesn't seem possible.
Test the code below.

Code:
function createShape(Parent)
 local sh = createComponentClass('TShape', Parent)
 sh.Parent = Parent
 return sh
end

if f2 then f2.destroy() end

f2 = createForm()
f2.Left = 318
f2.Height = 270
f2.Top = 247
f2.Width = 520
f2.Caption = 'Custom Progress Bar With Color Lerp'

TrackBar1 = createTrackBar(f2)
TrackBar1.Left = 42
TrackBar1.Height = 45
TrackBar1.Top = 30
TrackBar1.Width = 338
TrackBar1.Max = 100
TrackBar1.Position = 0

Shape1 = createProgressBar(f2)
Shape1.Left = 42
Shape1.Height = 45
Shape1.Top = 80
Shape1.Width = 340
Shape1.Visible=false
Shape1.Max = 100

TrackBar2 = createTrackBar(f2)
TrackBar2.Left = 42
TrackBar2.Height = 45
TrackBar2.Top = 140
TrackBar2.Width = 338
TrackBar2.Max = 100
TrackBar2.Position = 0

Shape2 = createProgressBar(f2)
Shape2.Left = 42
Shape2.Height = 45
Shape2.Top = 190
Shape2.Width = 340
Shape2.Visible=false
Shape2.Max = 100
---------------------------------------------

function createClrText(ownrF,ownrP,clr,fntSz)
local Sh2 = createShape(ownrF)
Sh2.Left = ownrP.Left
Sh2.Height = ownrP.Height
Sh2.Top = ownrP.Top
Sh2.Width = 0
Sh2.Brush.Color = clr
return Sh2
end

Shape1.Position = 0
Shape2.Position = 0
shp2 = createClrText(f2,Shape2,0xffff00,15)
shp1 = createClrText(f2,Shape1,0x00ff00,15)
----------------------------------------------

ss1 = createLabel(f2)
ss1.Left = Shape1.Left + Shape1.Width / 2 - 15
ss1.Top = Shape1.Top + Shape1.Height / 2 - 8
ss1.Font.Color = 0
ss1.Font.Size = 12

ss2 = createLabel(f2)
ss2.Left = Shape2.Left + Shape2.Width / 2 - 15
ss2.Top = Shape2.Top + Shape2.Height / 2 - 8
ss2.Font.Color = 0
ss2.Font.Size = 12

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

function shapePst(s1,s2,s3)
wd = s2.Width / Shape1.Max
s1.Width = s2.Position * wd
s3.Caption = tostring(s2.Position.."%")
end

function TrackBar1Change()
 Shape1.Position = TrackBar1.Position
shapePst(shp1, Shape1, ss1)
end

function TrackBar2Change()
 Shape2.Position = TrackBar2.Position
shapePst(shp2, Shape2, ss2)
end

TrackBar1.OnChange = TrackBar1Change
TrackBar2.OnChange = TrackBar2Change

f2.show()



In your form it's used like this:

Code:
UDF1.CEProgressbar1.Position = 0
UDF1.CEProgressbar1.Max = 100
UDF1.CETrackBar1.Position = 0
UDF1.CETrackBar1.Max = 100
---------------------------------------------
function createShape(Parent)
 local sh = createComponentClass('TShape', Parent)
 sh.Parent = Parent
 return sh
end

function createClrText(ownrF,ownrP,clr)
local Sh2 = createShape(ownrF)
Sh2.Left = ownrP.Left
Sh2.Height = ownrP.Height
Sh2.Top = ownrP.Top
Sh2.Width = 0
Sh2.Brush.Color = clr
return Sh2
end
---------------------------------------------
shp1 = createClrText(UDF1,UDF1.CEProgressbar1,0xffff00)

shp1.sendToBack()
UDF1.CELabel1.bringToFront()
UDF1.CEProgressbar1.Visible = false
----------------------------------------------

function shapePst(s1,s2,s3)
wd = s2.Width / Shape1.Max
s1.Width = s2.Position * wd
s3.Caption = tostring(s2.Position.."%")
end
------------------------------------------

UDF1.CETrackBar1.OnChange=function(sender)
UDF1.CEProgressbar1.Position = UDF1.CETrackBar1.Position
shapePst(shp1,UDF1.CEProgressbar1,UDF1.CELabel1)
end

UDF1.show()

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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