Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
How single procedure ends in different results
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How many lines is too man...
by
440bx
[
Today
at 07:40:03 pm]
REST Server/Client, how t...
by
kveroneau
[
Today
at 07:35:25 pm]
Variable initialization
by
LeP
[
Today
at 06:58:53 pm]
[SOLVED] Problem to resto...
by
Hartmut
[
Today
at 06:42:28 pm]
Debian removes FPC/Lazaru...
by
Martin_fr
[
Today
at 06:41:38 pm]
Text Fill (Memo)
by
Sc0li0sis
[
Today
at 06:08:54 pm]
BGRA Controls license inf...
by
Zoran
[
Today
at 05:48:27 pm]
TCalendar Assign a Date
by
eldonfsr
[
Today
at 05:04:10 pm]
Update a table with an Au...
by
wp
[
Today
at 04:16:29 pm]
[Feature Request]Add Larg...
by
TYDQ
[
Today
at 03:03:31 pm]
Receipt printers & lazare...
by
Petrus Vorster
[
Today
at 02:36:22 pm]
STOMP Clients Release 202...
by
mjustin
[
Today
at 01:56:25 pm]
FreePascal/Lazarus docume...
by
MarkMLl
[
Today
at 10:03:46 am]
PasLLM - LLM Inference En...
by
domasz
[
Today
at 08:53:15 am]
Lazarus IDE built for LCL...
by
dbannon
[March 05, 2026, 11:52:07 pm]
Should TEdit.Clear cause ...
by
Bart
[March 05, 2026, 10:07:40 pm]
Reset doesn't open ReadOn...
by
eny
[March 05, 2026, 09:29:24 pm]
unit ProjectDescriptorTyp...
by
n7800
[March 05, 2026, 09:27:11 pm]
Interface problem
by
PascalDragon
[March 05, 2026, 09:22:57 pm]
bgraformatui.pas(26,12) W...
by
PascalDragon
[March 05, 2026, 09:05:02 pm]
FPC says file exists, Laz...
by
cdbc
[March 05, 2026, 05:06:05 pm]
Lazarus Bugfix Release 4....
by
uganof
[March 05, 2026, 03:04:05 pm]
Add Help to an Applicatio...
by
1HuntnMan
[March 05, 2026, 02:41:40 pm]
composition instead of in...
by
BildatBoffin
[March 05, 2026, 01:16:31 pm]
Is it me or is there some...
by
jamie
[March 05, 2026, 12:03:37 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How single procedure ends in different results (Read 2077 times)
Marion
Full Member
Posts: 125
How single procedure ends in different results
«
on:
November 28, 2024, 12:42:47 am »
I have a procedure that dynamically adds controls to a TScrollBox with the ChildSizing.ControlsPerLine = 1 so the controls stack from top to bottom. When the ScrollBox starts empty then the child controls are the correct height (See image with empty TEdit). Once a user enters text and saves the dialog, the next time they come back to the form, I repopulate the rows and add the text but now the TEdits are short. When I add a new (empty) row, all of the rows (including the previous ones) stretch to the right height. I'd like to fix this if someone knows what's going on.
Below is the procedure used to add all of the rows to the ScrollBox:
Code: Pascal
[Select]
[+]
[-]
function
TfrmOptions
.
DiceTrayRowAdd
:
TPanel
;
var
pnlRow
:
TPanel
;
txtName
,
txtFormula
:
TEdit
;
begin
pnlRow
:
=
TPanel
.
Create
(
boxDiceTray
)
;
pnlRow
.
Parent
:
=
boxDiceTray
;
pnlRow
.
Tag
:
=
FDiceRow
;
pnlRow
.
BevelOuter
:
=
bvNone
;
pnlRow
.
ChildSizing
.
ControlsPerLine
:
=
2
;
pnlRow
.
ChildSizing
.
EnlargeHorizontal
:
=
crsHomogenousChildResize
;
pnlRow
.
ChildSizing
.
Layout
:
=
cclLeftToRightThenTopToBottom
;
//pnlRow.Name := Format('pnlDiceRow%d', [FDiceRow]);
pnlrow
.
Caption
:
=
''
;
pnlRow
.
OnEnter
:
=
@
DiceTrayRowEnter
;
txtName
:
=
TEdit
.
Create
(
pnlRow
)
;
txtName
.
Parent
:
=
pnlRow
;
//txtName.Name := Format('txtDTName%d', [FDiceRow]);
txtName
.
Text
:
=
''
;
txtName
.
MaxLength
:
=
20
;
txtName
.
OnKeyUp
:
=
@
DiceTrayRowKeyUp
;
txtFormula
:
=
TEdit
.
Create
(
pnlRow
)
;
txtFormula
.
Parent
:
=
pnlRow
;
//txtFormula.Name := Format('txtDTFormula%d', [FDiceRow]);
txtFormula
.
Text
:
=
''
;
txtFormula
.
MaxLength
:
=
40
;
txtFormula
.
OnKeyUp
:
=
@
DiceTrayRowKeyUp
;
if
txtName
.
CanFocus
then
txtName
.
SetFocus
;
FDiceRow
:
=
FDiceRow
+
1
;
result
:
=
pnlRow
;
end
;
Logged
Thank you,
Marion
(A recovering Windows programmer.)
CharlyTango
Full Member
Posts: 178
Re: How single procedure ends in different results
«
Reply #1 on:
November 28, 2024, 09:39:15 am »
You will certainly have a reason why you choose a solution with a TScrollbos, which is significantly more complex and problematic than other controls.
I would try to solve such “simple” inputs with a TStringgrid, for example
Logged
Lazarus stable, Win32/64
jamie
Hero Member
Posts: 7587
Re: How single procedure ends in different results
«
Reply #2 on:
November 28, 2024, 05:32:17 pm »
AutoSize is set to true maybe?
in any case, I am not sure how the child sizing works but best guess is it may use the FONT height. Maybe you need to set that in the EDIT fields.
Logged
The only true wisdom is knowing you know nothing
Marion
Full Member
Posts: 125
Re: How single procedure ends in different results
«
Reply #3 on:
December 03, 2024, 01:57:43 am »
I finally fixed it. I had to add a Contraints.MinHeight = 40 to each of the TEdits and now it works as expected.
«
Last Edit: December 03, 2024, 02:00:03 am by Marion
»
Logged
Thank you,
Marion
(A recovering Windows programmer.)
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
How single procedure ends in different results
TinyPortal
© 2005-2018