Recent

Author Topic: Childsizing - how to rearrange components  (Read 6619 times)

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Childsizing - how to rearrange components
« on: January 19, 2011, 03:49:47 pm »
Hi,

I have panel with:
Pane1.ChildSizing.ControlsPerLine := 1;
Pane1.ChildSizing.Layout := cclTopToBottomThenLeftToRight;

... and some buttons on this panel. How can I change button positions on runtime?

Regards.

w click

  • Full Member
  • ***
  • Posts: 180
Re: Childsizing - how to rearrange components
« Reply #1 on: January 19, 2011, 04:49:05 pm »
Buttons all have a top and left as well as a width and height, so:-

with button6 do begin
   top:=top-1;
   left:=left+1;
   width:=width+1;
   height:=height+1;
end;

So clicking button6 makes it taller, fatter and move slowly North East.  You could make it top:=5; left:=5; to move it to the top left position.

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: Childsizing - how to rearrange components
« Reply #2 on: January 19, 2011, 04:59:04 pm »
Yes, but it seems like "Childsizing" blocking Left and Top

DirkS

  • Sr. Member
  • ****
  • Posts: 251
Re: Childsizing - how to rearrange components
« Reply #3 on: January 19, 2011, 06:15:21 pm »
Yes, but it seems like "Childsizing" blocking Left and Top
I think that's because of your Layout setting. You can either set Childsizing.xxxSpacing settings to adjust the location of buttons or do everything by hand by setting ChildSizing.Layout to cclNone.

Gr.
Dirk.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9867
  • Debugger - SynEdit - and more
    • wiki
Re: Childsizing - how to rearrange components
« Reply #4 on: January 19, 2011, 07:02:30 pm »
I don't think there is a convenient way...

it is kind of bound to creation order, more specific the order elements have in the parents list of child-controls.

Therefore changing the parent of any of your buttons, away and back to the container, will move that button to the last position.

In design you can drag and drop the child-controls in the tree-view of the object inspector.

--
Not tested, but at runtime

ButtonX.Parent := nil;
ButtonX.Parent := Container;

to move it to last position...
« Last Edit: January 19, 2011, 07:04:30 pm by Martin_fr »

 

TinyPortal © 2005-2018