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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Lazarus Release Candidate...
by
CM630
[
Today
at 08:59:24 am]
Getting format error load...
by
MISV
[
Today
at 08:42:52 am]
Generic methods inside a ...
by
Khrys
[
Today
at 07:13:28 am]
Compile on multiple distr...
by
dodgebros
[
Today
at 05:44:44 am]
Application.ProcessMessag...
by
440bx
[
Today
at 04:45:21 am]
SDL3 Headers for FPC
by
Guva
[
Today
at 04:05:01 am]
Painting on a control - 3...
by
lainz
[
Today
at 03:04:18 am]
Does unit recompilation r...
by
Fred vS
[
Today
at 02:34:42 am]
Resolving procedure symbo...
by
TCH
[
Today
at 01:04:13 am]
UK's Online Safety Act
by
Joanna from IRC
[
Today
at 12:24:54 am]
debugging code for te ACS...
by
dseligo
[January 22, 2025, 11:03:34 pm]
Run ffmpeg via TProcess
by
TRon
[January 22, 2025, 10:52:55 pm]
Lazarus Bugfix Release 3....
by
Martin_fr
[January 22, 2025, 10:41:06 pm]
Minor Q: HowTo use 'Debug...
by
d7_2_laz
[January 22, 2025, 09:40:14 pm]
How C++ class multiple in...
by
Thaddy
[January 22, 2025, 07:55:26 pm]
Mormot2 and websocket cli...
by
BlueIcaro
[January 22, 2025, 07:25:35 pm]
crash db navigator with L...
by
calm_sea
[January 22, 2025, 06:04:33 pm]
Три вопроса новичка: OnPa...
by
majolika
[January 22, 2025, 05:30:20 pm]
Preparing FPC 3.2.4, poin...
by
BSaidus
[January 22, 2025, 04:19:20 pm]
Permuted index for RTL an...
by
Thaddy
[January 22, 2025, 03:52:14 pm]
My first "tool" written w...
by
TBMan
[January 22, 2025, 03:11:42 pm]
Select cell in listview /...
by
Jonny
[January 22, 2025, 02:34:09 pm]
How do you maintain your ...
by
Martin_fr
[January 22, 2025, 12:21:29 pm]
BGRA Controls
by
circular
[January 22, 2025, 11:10:43 am]
Generating a wrapper for ...
by
MarkMLl
[January 22, 2025, 11:02:42 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How single procedure ends in different results (Read 1108 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
Jr. Member
Posts: 91
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: 6791
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