• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 489
  • Last Modified:

Delphi2010: Layout Problem

hi all,

in one project there is a form A which use a parent form B.

in form A there is a TEdit component, if this component is moved vertically in the IDE, it can be correctly displayed when the application runs. But if this componet is moved  horizontally in the IDE, it turns back to the original position when the application runs.

following are some related information of this TEdit component:

Align: alNone
left: 200

any suggestion?

btw, are there special books or ressource to explain how to design layout in Delphi?


3 Solutions
Geert GOracle dbaCommented:
post the 2 dfm sources

there is some considerations when redesigning the parent form
when using VFI (Visual Form Inheritance)
When Form B calls form A do you set the Left value of the TEdit component in your code (e.g. OnFormA Show or even from Form B) ?
wantimeAuthor Commented:
thanks, but the codes is not for public.

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Geert GOracle dbaCommented:
then post only the related piece of code

the header of the form
and the piece for the edit

of both forms

too many variables otherwise to ask for
Geert GOracle dbaCommented:
the biggest problem is with default values
and if they are stored or not in the dfm

this is not so for positioning, but i'm just trying to explain with the property Left

  default value for property Edit.Left: 50
  if default value > not stored in dfm

start situation
Form A dfm
  > Edit1.Left = 60

Form B dfm (inherited from Form A)

Form B will only store the differences with Form A

situation 2: change form B
Form B
  > Edit1.Left = 80
> save form B > no problem

situation 3: change form A
Form A
  > Edit1.Left = 70
> save form A

the component Edit1 will remain on Edit1.Left = 80 on Form B

there may be other factors  too
 like anchors, margins, oldcreateorder

Ephraim WangoyaCommented:

You probably have code thats specifically setting the the edit's left property or some event that when triggered repositions the Edit

In an inherited form, if you move a control, the controls position is saved in the dfm and thats whats loaded.
You should be able to, easily, create a do nothing example project that you CAN post on this site.  Then the experts would at least have something to work with...
wantimeAuthor Commented:
thanks. there are some codes which resetting the edit's left property.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now