|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
salumor Advanced Cheater Reputation: 0
Joined: 14 Jan 2019 Posts: 84
|
Posted: Sun Dec 19, 2021 5:02 pm Post subject: Add/Remove EditBox via Button |
|
|
Hi, I did search quite a lot and can't rly believe this was never topic but can't find s.t. like that (probably search terms but dunno what to search else). Anyway if someone knows an example a simple link is enough.
I would need a form with a box and prob 3 buttons while 2 of them add/remove another box (max # lets say 10) positioned below also changing the formsize, basically s.t. like the Add/Remove Offset Buttons for pointers. (The 3rd button will do the action on what's set for each box)
Now I wonder is it possible to dynamically add them? Or can I only create them first and simply hide/show?
EDIT: So i've set up the code for the static method (create+hide). But yeah ... that's quite ugly. Any other way?
Code: | HighestBox = 1
local function recalcheight(h1,h2,x,y)
f.Height = f.Height + h2*y + 10*y
b1.top = h1 + h2*x + 10*x
b2.top = b1.top
b3.top = b1.top
end
local function add()
--add another box edti below lowest edt and resize f / set b0.top?
--[[ since s.t. like the following is not possible ....
local Box = 1
local edt[Box] = createEdit(f)
]]--
if HighestBox == 1 then
edt2.visible = true
recalcheight(edt2.top,edt2.height,1,1)
else
if HighestBox == 2 then
edt3.visible = true
recalcheight(edt3.top,edt3.height,1,1)
end
--and so on
end
if HighestBox < 3 then HighestBox = HighestBox + 1 end
end
local function remove()
--remove the (visually) lowest etd except edt1 and resize f / set b0.top?
if HighestBox == 3 then
edt3.visible = false
recalcheight(edt3.top,edt3.height,0,-1)
else
if HighestBox == 2 then
edt2.visible = false
recalcheight(edt2.top,edt2.height,0,-1)
end
end
if HighestBox > 1 then HighestBox = HighestBox - 1 end
end
local function set()
--run for i = #boxes
for i = 1,HighestBox do
end
end
btn ={ [true]=1, [false]=0 }
f = createForm(true)
f.Width = 200
f.Height = 100
f.BorderStyle = 'Single'
f.Position ='poScreenCenter'
f.Caption = 'Test'
edt1 = createEdit(f) --unclear it will stay an EditBox but anyhow
edt1.left = 10
edt1.top = 10
edt1.width = 180
edt1.text = 'edt1'
edt2 = createEdit(f)
edt2.visible = false
edt2.left = 10
edt2.top = edt1.top + edt1.height + 10
edt2.width = 180
edt2.text = 'edt2'
edt3 = createEdit(f)
edt3.visible = false
edt3.left = 10
edt3.top = edt2.top + edt2.height + 10
edt3.width = 180
edt3.text = 'edt3'
edt4 = createEdit(f)
edt4.visible = false
edt4.left = 10
edt4.top = edt3.top + edt3.height + 10
edt4.width = 180
edt4.height = 0
edt4.text = 'edt4'
b1 = createButton(f)
b1.left = 10
b1.top = edt1.top + edt1.height + 10
b1.width = 50
b1.height = 30
b1.caption = 'Add'
b2 = createButton(f)
b2.left = b1.left + b1.width + 10
b2.top = b1.top
b2.width = 50
b2.height = 30
b2.caption = 'Remove'
b3 = createButton(f)
b3.left = b2.left + b2.width + 10
b3.top = b1.top
b3.width = 50
b3.height = 30
b3.caption = 'Set'
b1.onClick = add
b2.onClick = remove
b3.onClick = set |
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Sun Dec 19, 2021 9:18 pm Post subject: |
|
|
Here is an example.
https://forum.cheatengine.org/viewtopic.php?t=617942
There is also an example here, although not exhaustive:
Code: | if f then f.Destroy() f=nil end
f = createForm()
f.Width = 200
f.Height = 100
f.BorderStyle = 'Single'
f.Position ='poScreenCenter'
f.Caption = 'Test'
edt1 = createEdit(f) --unclear it will stay an EditBox but anyhow
edt1.left = 10
edt1.top = 10
edt1.width = 180
b1 = createButton(f)
b1.left = 10
b1.width = 50
b1.height = 30
b1.caption = 'Add'
b2 = createButton(f)
b2.left = b1.left + b1.width + 10
b2.width = 50
b2.height = 30
b2.caption = 'Remove'
b3 = createButton(f)
b3.left = b2.left + b2.width + 10
b3.width = 50
b3.height = 30
b3.caption = 'Set'
--############################################
local resEdt=0
local resTop=10
local resNmr=1
local EDT = { }
EDT.E1=createEdit(f) EDT.E1.visible=false
EDT.E2=createEdit(f) EDT.E2.visible=false
EDT.E3=createEdit(f) EDT.E3.visible=false
EDT.E4=createEdit(f) EDT.E4.visible=false
EDT.E5=createEdit(f) EDT.E5.visible=false
EDT.E6=createEdit(f) EDT.E6.visible=false
EDT.E7=createEdit(f) EDT.E7.visible=false
function btnTops()
b1.top = f.Height - 35
b2.top = f.Height - 35
b3.top = f.Height - 35
end
btnTops()
function crtEdit()
if resEdt==7 then
showMessage("Boxes have reached the max limit!")
else
resEdt=tonumber(resEdt) + 1
rstedt = EDT["E"..tonumber(resEdt)]
print(resEdt)
rstedt.left = 10
resTop=tonumber(resTop) + 30
rstedt.top = resTop
rstedt.width = 180
rstedt.visible=true
f.Height = f.Height + 35
btnTops()
end
end
function add()
crtEdit()
end
function remove()
print(resEdt)
if resEdt==0 then
showMessage("There are no more boxes created!")
else
rstedt = EDT["E"..tonumber(resEdt)]
rstedt.visible=false
f.Height = f.Height - 35
resEdt=tonumber(resEdt) - 1
btnTops()
end
end
function set()
local AvlEdt=tonumber(resEdt) + 1
showMessage("There are "..AvlEdt.." boxes available")
end
b1.onClick = add
b2.onClick = remove
b3.onClick = set |
|
|
Back to top |
|
|
salumor Advanced Cheater Reputation: 0
Joined: 14 Jan 2019 Posts: 84
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Mon Dec 20, 2021 8:05 am Post subject: |
|
|
Here is a more precise and simple way.
Code: | if f then f.Destroy() f=nil end
f = createForm()
f.Width = 200
f.Height = 100
f.BorderStyle = 'Single'
f.Position ='poScreenCenter'
f.Caption = 'Test'
edt1 = createEdit(f) --unclear it will stay an EditBox but anyhow
edt1.left = 10
edt1.top = 10
edt1.width = 180
b1 = createButton(f)
b1.left = 10
b1.width = 50
b1.height = 30
b1.caption = 'Add'
b2 = createButton(f)
b2.left = b1.left + b1.width + 10
b2.width = 50
b2.height = 30
b2.caption = 'Remove'
b3 = createButton(f)
b3.left = b2.left + b2.width + 10
b3.width = 50
b3.height = 30
b3.caption = 'Set'
--############################################
local resEdt=0
--local resTop=10
local EDT = { }
EDT.E1=createEdit(f) EDT.E1.Top=42
EDT.E2=createEdit(f) EDT.E2.Top=74
EDT.E3=createEdit(f) EDT.E3.Top=106
EDT.E4=createEdit(f) EDT.E4.Top=138
EDT.E5=createEdit(f) EDT.E5.Top=170
EDT.E6=createEdit(f) EDT.E6.Top=202
EDT.E7=createEdit(f) EDT.E7.Top=234
for x =0, 6 do
EDT['E'..1+x].Left=10
EDT['E'..1+x].width=180
EDT['E'..1+x].visible=false
end
function btnTops()
b1.top = f.Height - 35
b2.top = f.Height - 35
b3.top = f.Height - 35
end
btnTops()
function crtEdit()
if resEdt==7 then
showMessage("Boxes have reached the max limit!")
else
resEdt=tonumber(resEdt) + 1
rstedt = EDT["E"..tonumber(resEdt)]
print(resEdt)
rstedt.visible=true
f.Height = f.Height + 35
btnTops()
end
end
function add()
crtEdit()
end
function remove()
print(resEdt)
if resEdt==0 then
showMessage("There are no more boxes created!")
else
rstedt = EDT["E"..tonumber(resEdt)]
rstedt.visible=false
f.Height = f.Height - 35
resEdt=tonumber(resEdt) - 1
btnTops()
end
end
function set()
local AvlEdt=tonumber(resEdt) + 1
showMessage("There are "..AvlEdt.." boxes available")
end
b1.onClick = add
b2.onClick = remove
b3.onClick = set |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Mon Dec 20, 2021 8:16 am Post subject: |
|
|
The childsizing property is quite handy as well
(also, those values like 30, 35, 180, will be different depending on the DPI of your system)
_________________
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 |
|
|
salumor Advanced Cheater Reputation: 0
Joined: 14 Jan 2019 Posts: 84
|
Posted: Mon Dec 20, 2021 3:15 pm Post subject: |
|
|
Thx DB. Yeah, it's quite nice ... when you get it. I do not (see below ). Also how about not creating the boxes in advance and remove, not hide?
I think for my purpose generally as long as the distance between all boxes in % stays the same I prob. won't mind. But if I would just how to take care of that? Any Example?
Code: | if f then f.Destroy() f=nil end
f = createForm()
f.Width = 200
f.Height = 100
f.BorderStyle = 'Single'
f.Position ='poScreenCenter'
f.Caption = 'Test'
f.ChildSizing.Layout = "cclNone" --cclToptoBottomThenLeftToRight ?
for i=0,1 do
p[i] = createPanel(f) ---is Panel the best to use as a "Group"?
p[i].ChildSizing.ControlsPerLine=3
p[i].BorderSpacing.Top=10
p[i].BorderSpacing.Bottom=10
p[i].ChildSizing.LeftRightSpacing=10 --VerticalSpacing
p[i].ChildSizing.TopBottomSpacing=10 --HorizontalSpacing
p[i].AutoSize=false
p[i].SetBorder=0 --not? Found that on some lua code but doesn't seem to work.
-- p[i].ChildSizing=true needed?
end
p[0].ChildSizing.Layout = "cclNone" --cclToptoBottomThenLeftToRight ?
p[1].ChildSizing.Layout = "cclLeftToRightThenTopToBottom"
edt0 = createEdit(f) --unclear it will stay an EditBox but anyhow
--edt0.left = 10 -- we can forget about them, right?
--edt0.top = 10
edt0.width = 180
edt0.parent = p[0]
b1 = createButton(f)
--b1.left = 10
--b1.width = 50
b1.height = 30
b1.caption = 'Add'
b1.parent = p[1]
b2 = createButton(f)
--b2.left = b1.left + b1.width + 10
--b2.width = 50
b2.height = 30
b2.caption = 'Remove'
b2.parent = p[1]
b3 = createButton(f)
--b3.left = b2.left + b2.width + 10
--b3.width = 50
b3.height = 30
b3.caption = 'Set'
b3.parent = p[1]
--############################################
local resEdt=0
--local resTop=10
local EDT = { }
function btnTops()
b1.top = f.Height - 35
b2.top = f.Height - 35
b3.top = f.Height - 35
end
btnTops()
function crtEdit()
if resEdt==7 then
showMessage("Boxes have reached the max limit!")
else
resEdt=tonumber(resEdt) + 1
EDT["E"..tonumber(resEdt)] = createEdit(f)
rstedt = EDT["E"..tonumber(resEdt)]
print(resEdt)
--resTop=tonumber(resTop) + 36
--rstedt.left = 10
--rstedt.top = calTop
rstedt.width = 180
rstedt.visible=true
rstedt.Parent = p[0]
f.Height = f.Height + 35
btnTops()
end
end
function add()
crtEdit()
end
function remove()
print(resEdt)
if resEdt==0 then
showMessage("There are no more boxes created!")
else
rstedt = EDT["E"..tonumber(resEdt)]
--rstedt.visible=false
rstedt.destroy()
f.Height = f.Height - 35
resEdt=tonumber(resEdt) - 1
btnTops()
end
end
function set()
local AvlEdt=tonumber(resEdt) + 1
showMessage("There are "..AvlEdt.." boxes available")
end
b1.onClick = add
b2.onClick = remove
b3.onClick = set |
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Mon Dec 20, 2021 9:48 pm Post subject: |
|
|
If you want to use these edit boxes, you need to create and assign them beforehand.
It seems difficult to use the generated ones after the form is created.
First create the boxes, then use them (Visible=true or false and Text="")
Or explain what you want to do with this form.
EDIT:
With buttons in 100 predefined boxes and panels:
Code: | if f then f.Destroy() f=nil end
f = createForm()
f.Width = 200
f.Height = 90
f.BorderStyle = 'Single'
f.Position ='poScreenCenter'
f.Caption = 'Test'
f.ChildSizing.Layout = "cclNone" --cclToptoBottomThenLeftToRight ?
local p = {}
local p1=createPanel(f)
p1.height=40 p1.Width=190 p1.left=5 p1.top=5
edt0 = createEdit(f)
edt0.width=180 edt0.Left=10 edt0.top=55
b1 = createButton(p1)
b1.height=30 b1.left=5 b1.Width=45 b1.top=5
b1.caption='Add'
b2 = createButton(p1)
b2.height=30 b2.left=55 b2.Width=80 b2.top=5
b2.caption = 'Remove'
b3 = createButton(p1)
b3.height=30 b3.left=140 b3.Width=45 b3.top=5
b3.caption = 'Set'
--############################################
local resEdt=0
local resTop=55
local EDT = { }
for x = 0, 100 do
EDT['E'..1+x]=createEdit(f)
resTop=tonumber(resTop) + 35
EDT['E'..1+x].Left=10
EDT['E'..1+x].top=resTop
EDT['E'..1+x].width=180
EDT['E'..1+x].visible=false
end
function crtEdit()
if resEdt==100 then
showMessage("Boxes have reached the max limit!")
else
resEdt=tonumber(resEdt) + 1
rstedt = EDT["E"..tonumber(resEdt)]
print(resEdt)
rstedt.visible=true
f.Height = f.Height + 35
end
end
function add()
crtEdit()
end
function remove()
print(resEdt)
if resEdt==0 then
showMessage("There are no more boxes created!")
else
rstedt = EDT["E"..tonumber(resEdt)]
rstedt.visible=false
f.Height = f.Height - 35
resEdt=tonumber(resEdt) - 1
end
end
function set()
local AvlEdt=tonumber(resEdt) + 1
showMessage("There are "..AvlEdt.." boxes available")
--print(EDT.E2.Text)
end
b1.onClick = add
b2.onClick = remove
b3.onClick = set |
|
|
Back to top |
|
|
salumor Advanced Cheater Reputation: 0
Joined: 14 Jan 2019 Posts: 84
|
Posted: Tue Dec 21, 2021 3:40 pm Post subject: |
|
|
Dark Byte wrote: | The childsizing property is quite handy as well
(also, those values like 30, 35, 180, will be different depending on the DPI of your system) | So i've been playing with that .... but i've got 3 questions:
- Why is f.AutoSize so useless? (EDIT: yeah cause it's on start)
- Any other way to append one group below another? (and except manuall counting but i mean .. i've been looking into anchors ... maybe that way?)
- Is there any kind of group I can use where I can set invisible borders?
(EDIT: with the code below i do see sometimes visual glitches on g[1])
ByTransient wrote: | If you want to use these edit boxes, you need to create and assign them beforehand. | This was bugging me. Why? See below. (After all your efforts & mine & .... : quickly generated for testing only ... dunno if failproof ... depending what u click ugly ... just an example)
Code: | -- Form
if f then f.Destroy() f=nil end
f = createForm()
curEdt = 8
-- Outer Group
g,e,b = {},{},{}
for i=0,1 do
g[i] = createGroupBox(f)
g[i].ChildSizing.Layout=cclLeftToRightThenTopToBottom
g[i].ChildSizing.VerticalSpacing=5
g[i].ChildSizing.HorizontalSpacing=10
g[i].ChildSizing.LeftRightSpacing=20
g[i].ChildSizing.TopBottomSpacing=30
g[i].ChildSizing.Layout = "cclLeftToRightThenTopToBottom"
g[i].AutoSize=true
g[i].BevelOuter=0
end
g[0].ChildSizing.ControlsPerLine=3
g[1].ChildSizing.ControlsPerLine=5
g[1].ChildSizing.TopBottomSpacing=50
print(g[0].Height)
-- Edits and Buttons
for i=0,8 do
e[i] = createEdit(f)
e[i].Parent = g[0]
e[i].Text = i
end
for i=0,9 do
b[i] = createButton(f)
b[i].Parent = g[1]
b[i].Caption = i
end
--This is one of the questionable parts
print(g[0].Height) --interesting, how it's calculated after boxes being added
g[1].Top=g[0].Height
function add()
if curEdt==12 then
showMessage("Boxes have reached the max limit!")
else
curEdt=tonumber(curEdt) + 1
e[curEdt] = createEdit(f)
e[curEdt].Parent = g[0]
e[curEdt].Text = i
print(curEdt)
g[1].Top=g[0].Height
f.AutoSize = true
end
end
function remove()
if curEdt==8 then
showMessage("There are no more boxes created!")
else
print(curEdt)
e[curEdt].destroy()
curEdt=tonumber(curEdt) - 1
g[1].Top=g[0].Height
f.AutoSize = true
end
end
function set()
for i=0,8 do
e[i].Text=i+i
end
if curEdt > 8 then
for i=9,curEdt do
e[i].Text=i+i
end
end
end
b[0].onClick = add
b[1].onClick = remove
b[2].onClick = set
b[0].Caption = "Add" -- be award of btn size
b[1].Caption = "Rem"
b[2].Caption = "Set"
f.AutoSize = true -- of course at end ... |
Last edited by salumor on Wed Dec 22, 2021 2:59 am; edited 2 times in total |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Tue Dec 21, 2021 5:48 pm Post subject: |
|
|
I still don't understand what you want to do with this form.
Also, if you don't want a border (Border), use Panel.
"AutoSize" takes effect if used right after the object creation code.
Code: | if f then f.Destroy() f=nil end
f = createForm()
f.AutoSize = false --opps (true.size=40x5)
f.Width = 400
f.Height = 400
--f.AutoSize = true
-- Outer Group
g,e,b = {},{},{}
for i=1,4 do
g[i] = createPanel(f) --GroupBox(f)
g[i].AutoSize=true
g[i].ChildSizing.VerticalSpacing=5
g[i].ChildSizing.HorizontalSpacing=10
g[i].ChildSizing.LeftRightSpacing=20
g[i].ChildSizing.TopBottomSpacing=10
g[i].ChildSizing.ControlsPerLine=3
g[i].ChildSizing.Layout = "cclLeftToRightThenTopToBottom"
g[i].BevelOuter=0
end
g[2].visible=false
g[3].visible=false
g[3].Top,g[1].Top,g[2].Top,g[4].Top=10,10,10,160
g[4].ChildSizing.ControlsPerLine=5
g[4].ChildSizing.TopBottomSpacing=10
g[4].BevelOuter=2 --0,1,2
-- Edits and Buttons
for i=1,27 do
e[i] = createEdit(f)
e[i].Text = i
if i>=1 and i<=9 then
--print("G1",i)
e[i].Parent = g[1]
elseif i>=9 and i<=18 then
--print("G2",i)
e[i].Parent = g[2]
elseif i>=18 and i<=27 then
--print("G3",i)
e[i].Parent = g[3]
end
end
for i=1,10 do
b[i] = createButton(f)
b[i].Parent = g[4]
b[i].Caption = i
end
function GboxVsbl()
for i=1,3 do
g[i].visible=false
end
end
b[1].onClick = function() GboxVsbl() g[1].visible=true end
b[2].onClick = function() GboxVsbl() g[2].visible=true end
b[3].onClick = function() GboxVsbl() g[3].visible=true end |
|
|
Back to top |
|
|
salumor Advanced Cheater Reputation: 0
Joined: 14 Jan 2019 Posts: 84
|
Posted: Wed Dec 22, 2021 6:02 am Post subject: |
|
|
I think I've got it now.
As for what I want to in the end is simply providing a form to my table where the user can config different stuff (with the option to add mutliple configs) and then set/run my code.
Notes: AutoSize will reform the element ... live ... if it does know it's childs (so set true ... once ... after all primary elements added, not including "new child of child elements").
EDIT: Hmm. I do keep getting visual glitches if I i try to remove the parent line like e[curEdt] = createEdit(f) / e[curEdt].Parent = p[0] -- to e[curEdt] = createEdit(p[0])
BTW: if you need more info: https://wiki.freepascal.org/Autosize_/_Layout , (german) https://www.lazarusforum.de/viewtopic.php?t=13192 (so you can size using f.e. Constraints.MinWidth)
Code: | -- Form
if f then f.Destroy() f=nil end
f = createForm()
--f.AutoSize = true -- here AutoSize is quite problematic, prob. because it doesn't know it's childs
print("F1: ",f.Height)
f.ChildSizing.Layout = "cclLeftToRightThenTopToBottom"
f.ChildSizing.ControlsPerLine=1
-- Outer Group
curEdt = 8 --just quick/dirty to show how ControlsPerLine work
p,e,b = {},{},{}
for i=0,1 do
p[i] = createPanel(f)
p[i].ChildSizing.VerticalSpacing=5
p[i].ChildSizing.HorizontalSpacing=10
p[i].ChildSizing.LeftRightSpacing=20
p[i].ChildSizing.TopBottomSpacing=30
p[i].ChildSizing.Layout = "cclLeftToRightThenTopToBottom"
p[i].AutoSize=true
p[i].BevelOuter=0
p[i].BevelWidth=0
end
p[0].ChildSizing.ControlsPerLine=3
p[1].ChildSizing.ControlsPerLine=5
p[1].ChildSizing.TopBottomSpacing=50
print("P1: ",p[0].Height)
-- Edits and Buttons
for i=0,8 do
e[i] = createEdit(f)
e[i].Parent = p[0]
e[i].Text = i
end
for i=0,9 do
b[i] = createButton(f)
b[i].Parent = p[1]
b[i].Caption = i
b[i].Constraints.MinWidth = 50
end
print("P2: ",p[0].Height,e[1].Width)
-- Functions
function add()
if curEdt==12 then
print("Max Limit!")
else
curEdt=tonumber(curEdt) + 1
e[curEdt] = createEdit(f)
e[curEdt].Parent = p[0]
e[curEdt].Text = i
print(curEdt)
f.AutoSize = true
end
end
function remove()
if curEdt==8 then
print("Min Limit!")
else
print(curEdt)
e[curEdt].destroy()
curEdt=tonumber(curEdt) - 1
f.AutoSize = true
end
end
function set()
for i=0,8 do
e[i].Text=i+i
end
if curEdt > 8 then
for i=9,curEdt do
e[i].Text=i+i
end
end
end
b[0].onClick = add
b[1].onClick = remove
b[2].onClick = set
b[0].Caption = "Add" -- be award of btn size
b[1].Caption = "Rem"
b[2].Caption = "Set"
--after all element's added
f.AutoSize = true
print("F2: ",f.Height) --- here AutoSize is better |
Description: |
|
Filesize: |
2.6 KB |
Viewed: |
2512 Time(s) |
|
Last edited by salumor on Sun Jan 16, 2022 6:37 am; edited 3 times in total |
|
Back to top |
|
|
etioplmld Advanced Cheater Reputation: 0
Joined: 09 Feb 2021 Posts: 72
|
Posted: Wed Dec 22, 2021 7:52 am Post subject: |
|
|
This can be used as a reference, maybe it is the wrong code, come on and try
Code: |
f = createForm(true)
f.Position=poDesktopCenter
f.Width=300
f.Height=115
f.Caption = 'Add addresses '
local b1=createButton(f)
b1.Left=180
b1.Top=10
b1.caption="add address"
b1.Width=100
local b2=createButton(f)
b2.Left=180
b2.Top=40
b2.caption="add offset"
b2.Width=100
local b3=createButton(f)
b3.Left=180
b3.Top=70
b3.caption="remove offset"
b3.Width=100
local eb=createEdit(f)
eb.Left=10
eb.Top=10
eb.Width=130
eb.TextHint='base address'
local eb1 =createEdit(f)
eb1.Left=10
eb1.Top=40
eb1.Width=130
eb1.Text= 1
bn = 1
local jn = {}
b2.OnClick=function()
jn[bn] = string.format("ex%d", bn)
jn[bn]=createEdit(f)
jn[bn].Left=10
jn[bn].Top= 70 + 25*bn
jn[bn].TextHint=string.format("offset%d", bn)
bn = bn + 1
f.Height=f.Height + 25
end
b3.OnClick=function()
bn= bn -1
jn[bn].destroy()
jn[bn]=nil
f.Height=f.Height - 25
end
|
https://forum.cheatengine.org/viewtopic.php?t=618747
Description: |
|
Filesize: |
36.97 KB |
Viewed: |
2493 Time(s) |
|
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Dec 22, 2021 8:36 am Post subject: |
|
|
salumor wrote: | I think I've got it now, though I don't know if the use of AutoSize here is as it's intended. Also I don't know why AutoSize directly after createForm + at end is such a problem?
Code: |
function set()
for i=0,8 do
e[i].Text=i+i
end
if curEdt > 8 then
for i=9,curEdt do
e[i].Text=i+i
end
end
end
|
|
Ok.
1) I think you didn't look at the link in my first answer.
There's a lot of different code out there that's worth archiving.
2) Your code, which I gave in the example, does not reflect the actual result (it does not print)
Replace with:
Code: |
function set()
for i=0,8 do
e[i].Text=i
end
if curEdt > 8 then
for i=9,curEdt do
e[i].Text=i
end
end
end
|
3) Form and "add" are not useful as they are.
It's annoying that when clicking the "add" and "remove" button, the buttons slide out under the mouse arrow.
4) Try @etioplmld's code too, without straying too far from the main topic. However, it can be improved and different combinations can be tried.
(It's annoying that the buttons move up and down, as if the form should stay fixed. )
More options stand rich for the only good result.
|
|
Back to top |
|
|
salumor Advanced Cheater Reputation: 0
Joined: 14 Jan 2019 Posts: 84
|
Posted: Wed Dec 22, 2021 1:28 pm Post subject: |
|
|
etioplmld wrote: | This can be used as a reference, maybe it is the wrong code, come on and try | Maybe some for the set code. The string.formats are used nicely but my actual form will not have s.t. to make use of it. Btw:
Code: | jn[bn] = string.format("ex%d", bn) --isn't that line useless?
jn[bn]=createEdit(f) |
@ByTransient
1.) I did (and added it for CE) but I don't see what u're aiming at / what could be of use here.
2.) What? Huh? Why print? Why that change? I wrote that this is an example "quickly generated for testing only" and shall only show the basic layout & access! The actual form and code will look different / way more complex. Even if I would use that I would not understand why you want to remove "+ i". Anyhow IGNORE the whole "set" part.
3.) That, yeah ... I somewhat don't like how it looks but I get that it's convenient. I'll see if I can arrange it in a way that fits more to my liking
4.) see above
|
|
Back to top |
|
|
|
|
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
|
|