Search code examples
delphidelphi-xe

Controls won't remember their position on form


I have a (Delphi bug?) that is annoying me for months: in one of my apps I have some controls (tedit, tbutton, etc) on a TPanel. Every time I close the project and reopen it I find the controls moved few pixels up. After 20-30 closings the controls are almost out of the panel so I have to drag them back. Anybody encountered such a problem? How to fix it?

I have Delphi XE.


Update:
Actually I have encountered this in two of my projects. Both involve controls on a TPanel.
If I compile the project the controls, in the exe, the controls are at the wrong position also.
I have a TEdit that is aligned to the top (of the TPanel) and its bottom is anchored to the bottom. The bottom will also 'forget' its correct position and move to the top.


Update:
Bug confirmed. It appears when the user changes the Bevel properties of the panel!


Solution

  • This issue is reported in Quality Central #106320 for Delphi XE2, in June 2012.
    Its status is still 'need feedback', there is no sample project, but it looks as if has to do with descendant forms.

    I suggest that once you have determined the exact location that you want the components to be in, you adjust their position in the FormCreate.
    Then, in designmode you can just 'approximately' correct the position quickly, knowing that they will come out right at run-time.

    Robs suggestions also sound worth a try.

    BTW Should you manage to make a sample project, maybe others can then determine if it is fixed in later versions.