View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Sat Jul 26, 2025 8:27 am Post subject: Creating Label with code |
|
|
I have so far created a label on a form but I am having trouble with the Caption.
Code: |
self.form = createForm(false); -- self = trainer since it's a function inside of a table...
setProperty(self.form , "BiDiMode", "bdLeftToRight");
self.form.Caption = 'Cheat Panel';
self.form.Width = 350;
self.form.Height = 360;
self.form.Left = 800;
self.form.Top =10;
--
self.Instructions = createLabel(self.form);
self.Instructions.Width = 70;
self.Instructions.Height = 50;
self.Instructions.Left = 240;
self.Instructions.Top = 7;
self.Instructions.Caption = "Select Exp, Gold, and Hero to recalculate"
--
|
The caption if too wide to fit in the space provided.
So how may I insert a carriage return in one or more places in the caption?
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 36
Joined: 16 Feb 2017 Posts: 1511
|
Posted: Sat Jul 26, 2025 10:26 am Post subject: |
|
|
Try it in a separate lua tab.
Code: | self = {}
self.form = createForm(); -- self = trainer since it's a function inside of a table...
setProperty(self.form , "BiDiMode", "bdLeftToRight");
self.form.Caption = 'Cheat Panel';
self.form.Width = 350;
self.form.Height = 360;
self.form.Left = 800;
self.form.Top =10;
--
self.Instructions = createLabel(self.form);
self.Instructions.AutoSize=false
self.Instructions.Width = 70;
self.Instructions.Height = 50;
self.Instructions.Left = 240;
self.Instructions.Top = 7;
self.Instructions.Caption = "Select Exp, Gold, and Hero to recalculate"
-- self.Instructions.Tag = 100 -- > or 70
self.Instructions.OptimalFill=true
self.Instructions.WordWrap=true |
result:
Select Exp, Gold,
and Hero to
recalculate
_________________
|
|
Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Sat Jul 26, 2025 10:34 am Post subject: |
|
|
Thanks works great.
|
|
Back to top |
|
 |
Labyrnth Moderator
Reputation: 10
Joined: 28 Nov 2006 Posts: 6301
|
Posted: Sat Jul 26, 2025 11:55 am Post subject: |
|
|
few things could cause some issues, just make some adjusments.
Like above you can play with these to make adjustments.
------------------------------------------------------------------------
self.Instructions = createLabel(self.form);
self.Instructions.Left = 20;
self.Instructions.Top = 20;
self.Instructions.Width = 300; --Be sure caption isnt too short.
self.Instructions.Height = 50;
self.Instructions.Caption = "Select Exp, Gold, and Hero to recalculate";
self.Instructions.WordWrap = true;
self.Instructions.AutoSize = false;
self.Instructions.Font.Color = clBlack;
self.Instructions.Transparent = false;
self.Instructions.Color = clWhite;
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 36
Joined: 16 Feb 2017 Posts: 1511
|
Posted: Sat Jul 26, 2025 12:13 pm Post subject: |
|
|
Labyrnth wrote: | few things could cause some issues, just make some adjusments.
Like above you can play with these to make adjustments.
------------------------------------------------------------------------
self.Instructions = createLabel(self.form);
self.Instructions.Left = 20;
self.Instructions.Top = 20;
self.Instructions.Width = 300; --Be sure caption isnt too short.
self.Instructions.Height = 50;
self.Instructions.Caption = "Select Exp, Gold, and Hero to recalculate";
self.Instructions.WordWrap = true;
self.Instructions.AutoSize = false;
self.Instructions.Font.Color = clBlack;
self.Instructions.Transparent = false;
self.Instructions.Color = clWhite; |
It's likely a label with a small amount of space allocated to the right side of the form.
This allows long expressions to scroll down without spilling over the form.
Code: | self.Instructions = createLabel(self.form);
self.Instructions.AutoSize = false; -- For proper rendering, "AutoSize" should be used at the top of the sequence.
self.Instructions.Left = 20;
self.Instructions.Top = 20;
self.Instructions.Width = 70; -- 300 will go beyond the form.
self.Instructions.Height = 50;
self.Instructions.Caption = "Select Exp, Gold, and Hero to recalculate";
self.Instructions.WordWrap = true; -- Preventing side overflow.
self.Instructions.OptimalFill=true -- Keep within specified width and height limits. |
_________________
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25762 Location: The netherlands
|
Posted: Sat Jul 26, 2025 1:07 pm Post subject: |
|
|
you can also use [[string literals
that go to another line]]
_________________
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 |
|
 |
|