Page 1 of 1

Anchored vs. docked controls

Posted: 11 Feb 2016 8:13
by Ferenc Nagy
I know that anchors and docking of controls exclude each other.
Is there any tutorial explaining and comparing the two ways of sizing and positioning of the controls within a form?

Posted: 11 Feb 2016 9:28
by Thomas Linder Puls
No, such a tutorial does not exist.

Docking is good for filling an area with "large resizable" controls like (multiline-)editors, trees, lists, group boxes, ....

Anchoring is better to place "fixed sized"/small controls like buttons, edit controls, radio buttons, ...

As you mention it is not possible to mix the two concepts inside a single window, but you can for example use docking at an outer level and let one or more of the controls be a group box (with or without frame) the children of such a group box can then use anchoring. (The switch can also go the other way, from anchor to docking).

Docking does however (in its present form) have the rather huge drawback that the creation order (which is also the tab order) has a crucial influence on the layout. So unfortunately you will often get an undesirable tab order in order to obtain a certain layout.