View previous topic :: View next topic |
Author |
Message |
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Jan 26, 2022 10:01 am Post subject: Form label "Tag" setting problem. |
|
|
I've had this problem before because I fixed it by assigning a "Height" value.
Now I don't know how long the next word is, so instead of presetting the height, I want "Tag" to determine the height.
This is the working code:
Code: | if form then form.destroy() form = nil end
form = createForm()
form.Popupmode = 0;
form.Position = poDesktopCenter
form.Width = 220
form.Height = 240
local wrd1="aaaaaaaaa ssssssssssss ddddddd fffffffffff ghgggggggggg hhhhhhhhhhh jjjjjjjjjjjj xxxxxxxxxxxxx sssssssssssssss ffffffffffffffff ggggggggggggg hhhhhhhhhhhhhhhhhh"
l1=createLabel(form)
l1.AutoSize=false
l1.Alignment="taCenter"
l1.Left=10
l1.Top=30
l1.Width=200
l1.Height=75
l1.caption=wrd1
l1.Font.Size=11
l1.OptimalFill=true
l1.Tag=190
l1.visible=true
l1.WordWrap=true
print(l1.Height) --75 |
But I want it to be like this:
Code: | if form then form.destroy() form = nil end
form = createForm()
form.Popupmode = 0;
form.Position = poDesktopCenter
form.Width = 220
form.Height = 240
local wrd1="aaaaaaaaa ssssssssssss ddddddd fffffffffff ghgggggggggg hhhhhhhhhhh jjjjjjjjjjjj xxxxxxxxxxxxx sssssssssssssss ffffffffffffffff ggggggggggggg hhhhhhhhhhhhhhhhhh"
l1=createLabel(form)
l1.AutoSize= false
l1.Alignment="taCenter"
l1.Left=10
l1.Top=30
l1.Width=200
--l1.Height=75
--l1.OptimalFill=true
l1.caption=wrd1
l1.Tag=190
l1.Font.Size=11
l1.visible=true
l1.WordWrap=true
print(l1.Height .. " - " .. l1.Width) -- 1 - 200 |
Is there a solution for this?
|
|
Back to top |
|
|
Skyrimfus Cheater Reputation: 1
Joined: 17 Mar 2016 Posts: 42
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Wed Jan 26, 2022 11:02 am Post subject: |
|
|
Skyrimfus is partially right, the link is not correct in this instance. Cheat Engine was created using a mix of languages, including Pascal and as such, the tag property is there to discern the differences between two similar objects when dealing with events so that the caller knows which object to handle when queried.
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Jan 26, 2022 12:19 pm Post subject: |
|
|
If you only have suggestions for solutions, I think you should join the thread.
Although it is not a frequently requested issue, I give the following solution example until a different solution comes out:
Code: | if form then form.destroy() form = nil end
form = createForm()
form.Popupmode = 0;
form.Position = poDesktopCenter
form.Width = 220
form.Height = 240
local wrd1="aaaaaaaaa ssssssssssss ddddddd fffffff ffff ghgggg gggggg hhhhhh hhhhh jjjjjjj jjjjj xxxxxxx xxxxxx sssssss ssssssss fffffffff fffffff gggggggg ggggg hhhhhh hhhhhh hhhhhh"
l1=createLabel(form)
l1.Alignment="taCenter"
l1.Left=10
l1.Top=30
l1.Width=200
l1.Font.Size=10
local lineWord=""
local lineWord1=""
local lines=1
local wrd3=0
for w in wrd1:gmatch("%S+") do --print(w) end
aa=tonumber(#w) * 10
wrd3=tonumber(wrd3) + aa
lineWord = lineWord .. w .. " "
print(wrd3 )
if tonumber(wrd3)>200 then
lineWord1 = lineWord1 .. lineWord .. "\n"
lines=tonumber(lines) + 1
print(lineWord1 .. " - " .. wrd3)
lineWord=""
wrd3=0
end
end
lineWord1 = lineWord1 .. lineWord
lines=tonumber(lines) * 17
l1.AutoSize=false
l1.caption=wrd1
l1.Width=200
l1.Height=tonumber(lines)
l1.caption=lineWord1
print(l1.Height .. " - " .. l1.Width) |
It is still open to shorter samples.
|
|
Back to top |
|
|
|