Difference between revisions of "Anchor Layout Manager"

From wiki.visual-prolog.com

m (c)
(category)
 
Line 25: Line 25:
 
==References==
 
==References==
  
[[Category:Tutorials]]
 
 
[[Category:GUI]]
 
[[Category:GUI]]

Latest revision as of 10:43, 4 March 2016

When a dialog or a form is resized, the layout of controls should (most likely) be changed. A layout manager is a piece of software that handles the change of layout automatically. Visual Prolog can handle layout using anchors. An anchor fixes the distance of a side of a control to a surrounding container. The control can be anchored on zero to four sides.

What is Anchor

Let us imagine that we have a resizable container (a dialog, a form or a control container), and we want to keep a control near the right edge. So we can set:

Control:setAnchors([control::right]),

and the control will be moved on container resize to be near to the right edge.

Anchors in Details

Please look at the following table, which explains anchors in details. We will imply AnchorList is set as:

Control:setAnchors(AnchorList),

AnchorList value Explanation [control::right] The control will be moved on container resize to be near to the right edge. [control::bottom] The control will be moved on container resize to be near to the bottom edge. [control::left, control::right] The control will be resized on container resize to keep the margins to the left and right container's edges. [control::top, control::bottom] The control will be resized on container resize to keep the margins to the top and bottom container's edges. [] The control will be moved on container resize to keep its place in the container proportionally. I.e. if control was in the middle of the container, then it will be moved to stay in the middle. [control::left, control::top] The control will not be moved on container resize.Each PFC GUI control has the setting

Control:setAnchors([control::left, control::top]),

by default. That is, by default PFC GUI controls are not moved/resized.

The IDE Dialog Editor shows anchors for the selected control.

References