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
[New Component] ExtTabCtr...
by
d7_2_laz
[
Today
at 03:37:33 pm]
Can /my/ AI help me with ...
by
microxa
[
Today
at 02:25:12 pm]
SynEdit theme
by
LemonParty
[
Today
at 02:01:33 pm]
What happened to CocoaWSC...
by
Frank
[
Today
at 01:31:19 pm]
Very rough version of a s...
by
Hansvb
[
Today
at 12:44:31 pm]
Which Control should I us...
by
wp
[
Today
at 12:38:10 pm]
Fast Canvas Library V1.05...
by
microxa
[
Today
at 12:37:01 pm]
TCHATGPT — An Artificial ...
by
Martin_fr
[
Today
at 12:21:40 pm]
Pdf Viewer in Pascal
by
Dzandaa
[
Today
at 11:44:26 am]
Single and Double, Conver...
by
jamie
[
Today
at 12:00:51 am]
Lazarus Bugfix Release 4....
by
Martin_fr
[June 13, 2026, 11:02:41 pm]
Error with last fixes_3.2...
by
Fred vS
[June 13, 2026, 10:49:27 pm]
Lazarus 4.8 on Sourceforg...
by
Enos68
[June 13, 2026, 08:00:47 pm]
Conscious Artificial Inte...
by
Dzandaa
[June 13, 2026, 05:59:22 pm]
If FileExists(
by
Bart
[June 13, 2026, 05:57:26 pm]
docked IDE and form capti...
by
Paolo
[June 13, 2026, 02:53:50 pm]
New version of LazMapView...
by
wp
[June 13, 2026, 12:09:27 pm]
PadXml 1.1.0 – Portable A...
by
AlexanderT
[June 13, 2026, 10:38:42 am]
Arkanoid
by
Tomi
[June 13, 2026, 09:46:46 am]
Interesting video
by
Joanna
[June 13, 2026, 06:24:53 am]
IndySecOpenSSL is now ava...
by
TheMouseAUS
[June 13, 2026, 03:49:17 am]
Message CM_ShowingChanged...
by
LeP
[June 13, 2026, 02:13:51 am]
[SOLVED]Program experienc...
by
Cainnech
[June 13, 2026, 12:19:17 am]
TATTabs - how to stop a 3...
by
bobonwhidbey
[June 13, 2026, 12:03:15 am]
If you are looking for Wi...
by
avra
[June 12, 2026, 07:37:10 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How single procedure ends in different results (Read 2141 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: 180
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: 7773
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