Board index » delphi » Anchors problem

Anchors problem

Hi,

When I use anchors and set my form to scaled=false then my vcl's jumps about
20 points up towards the top.

Is this a bug in Delphi and how do I fix it??

Thanks in advance!

-Mojo

 

Re:Anchors problem


That's a Delphi VCL bug: it will also jump to the left for controls with
akRight.
Some how Delphi uses the clientrect rather than the actual window rect to
resize the controls.
I think I have only encountered this problem on sizable forms.

The only fix I am aware of is to postpone setting the anchors, or manually
move the controls to the correct position:

procedure TForm1.FormCreate(Sender: TObject);
begin
  // assume it's a button you want to align to the bottom, leave the anchors
in the designer to [akLeft, akTop]
  Button.Anchors := [akLeft, akBottom];
  // alternatively you could move the button to th eplace it should be;-(
  Button.Top := 256; // or whatever the correct initial position is. This is
not as nice because you need to manually maintain this code
  / if you change the button's position on the form
end;

Gerrit Beuze
ModelMaker

Quote
> When I use anchors and set my form to scaled=false then my vcl's jumps
about
> 20 points up towards the top.

> Is this a bug in Delphi and how do I fix it??

Other Threads