What is the meaning of "topmost" in the alMostTop alignment in TAlignLayout? - delphi

In the documentation for TAlignLayout, a type which addresses visual alignment settings for FireMonkey controls, I'm trying to figure out the difference between the alTop and alMostTop constants, the only difference is that the definition of alMostTop contains the phrase "set to be the topmost".
(The same goes for the constants alMostLeft, alMostRight and alMostBottom, which are distinguished from alLeft, alRight and alBottom with similar phrases using the words
"leftmost", "rightmost" and "bottommost".)
I don't know what "set to be the topmost" means, and none of the guesses I make seem to fit with observed FireMonkey behaviour:
If it means displaying that control on top (at the front of the display) relative to its siblings, then what does leftmost mean?
If "leftmost" means it is the sibling shown furthest to the left, out of all siblings that have a alLeft alignment, then why does the CustomListBox demo use a layout with two elements that have a alMostLeft alignment? How does it decide to place the two elements that particular way round?
The Embarcadero forums don't shed any light on this either.
[Update]
To be clear, experiments do indeed suggest that with two components aligned to the top, you can choose which one is to be further up the screen by setting that one to have alMostTop, and the other to alTop.
However, I thought of another possibility: suppose you have two child components, one to be aligned at the left, another aligned at the top. Then they will fight for ownership of the top-left corner. Experiments seem to suggest that some influence can be obtained by choosing between alTop and alMostLeft alignments for the two controls vs alMostTop and alLeft alignments. I can't see exactly what is going on here, and it's not clear in the documentation. It's also not clear what should/might happen if two child controls are both set to alMostTop.

When you have 2 (or more) controls aligned to top, the alMostTop will be on the top of all others. Same wise with alMostRight, alMostLeft, and alMostBottom.

Related

Edit the spacing between lines in any of Delphi FMX text components

is there a way to alter the spacing of any Delphi FMX component ? all are doubled spaced between lines i believe, i'm sure there is a way to edit the spacing between lines. the most important that it work for FMX
The difference between the two screenshots isn't that they have different line heights or line spacings.
The difference is that the left application is using a variable-width font, while the right application is using a fixed-width (monospaced) font.
You can see this extremely clearly in the top centre part of the image, where you have four full stops (....).
I assume you consider the right screenshot to display the desired appearance. If so, the solution is to change the font in the left application to a fixed-width (monospaced) font.

Spacing In VLayout

I am working inside a Tabpane and I want to have 2 buttons on the bottom-right of the tap-pane, so I thought I just add a LayoutSpacer, but this resulted in
but I wanted it to look like
How can I make my Layoutspacer "bigger"?
In Smart GWT there are different methods to set the size of the component's vertical dimension.
Try with any one
canvas.setHeight100()
canvas.setHeight("100%")
canvas.setHeight("*")
Layouts may specially interpret percentage sizes on their children, and also allow "*" as a size.

SpTBX: can I use Panels' DockedWidth/FloatingWidth

Moving from TBX to SpTBX. I used in the past TTbxDockablePanel which has such props:
DockedWidth
DockedHeight
FloatingWidth
FloatingHeight
I can't find such properties in SpTBX panels, so how should I change my code to use such props? ie. i need to get/set SpTBX panel's docked width/height and floating width/height.
DockedWidth and DockedHeight
A TSpTBXDockablePanel now has a property DefaultDockedSize. A docked panel is docked to either a vertical or horizontal dock, so it only needs one size, which specifies the width (in a vertical dock) or height (in a horizontal dock.) The length of the other axis is a result of either the dock size or the other panels in the same dock. If there are other panels, the size it becomes is the width of the other panels in the dock. If there aren't, it will use either the previous size (if DefaultDockedSize is 0) or try to use DefaultDockedSize.
See TSpTBXCustomDockablePanel.SetParent for the code. You'll be interested in the two branches beginning if ToDock then... and if ToFloating then.... There are some comments there that I've tried to interpret to write the above.
From memory, when I converted from TBX to SpTBX years ago, this was the hardest area to get behaving exactly the same. However, you can get it to behave 'okay', ie with behaviour that makes sense, easily.
FloatingWidth and FloatingHeight
Replaced by FloatingClientWidth and FloatingClientHeight. Note that these are the client sizes not window sizes, but in general they should be direct replacements.
In addition
There is a comment at the top of the SpTBXDkPanels.pas file,
// - To handle the size constraints use GetMinMaxSize when the DP is floating,
// and ConstrainedResize when is Docked (explicitly check if it's docked).
You might find that useful too.
There are a reasonable number of comments scattered through the code. The SpTBX library doesn't have very good documentation, but it does come with high-quality source... Use the source, Luke :)

How to deal with iOS UIViews rotation and alignment

In my existing app, I had 5 of my UIView derivatives (labels and buttons) laid up horizontally, i.e. on 0 degrees. They were all aligned on their left edges (so that button1.frame.origin.x = button2.frame.origin.x and so on.)
Now, for update purpose, I need to rotate all 5 of them, by 9 degrees anticlockwise.
I achieve the the rotation easily.
But I can't get how adjust their left edges so that they would all be aligned again after rotation.
The requirement, in summary, is this: The first control need to remain fixed (acting as pivot point) - the 4 others need to move right in order to maintain left alignment after rotation.
I tried putting incremental x value to each of the last 4 controls (keeping the pivot x fixed) but so far don't achieve exact alignment.
After rotation, it looks like all of them are center aligned, instead of left aligned which I really want.
I know what I really want, but just looking for a smarter way so that it won't be ugly like it is now.
Read about layout constraints. That will really help you in many ways. In layout constraints the concept is very simple like
Control1.attribute = Control2.attribute + C
So you can literally program each controls attributes and achieve a fine grain control. You can then code it such that all the controls X is same as other controls X, they are all same distance from another control etc.
You can have multiple layout constraints and the system will try to satisfy as many as possible.
But the only thing is that this is possible in iOS 6.0.

removing space around components in blackberry

I have a gui that keeps scrolling on the 8520 screen. I have used setPadding(XYEdges) and setMargin(XYEdges) to remove the spaces around the components on the UI but there's still space left in between these components. Are there other API calls i can make to remove spaces around components?
You need to consider the following:
setPadding refers to a boundary inside the border of a field and controls how close the internal content of the field can be to the border.
setMargin refers to a boundary outside the border of a field and controls how close the field can be to an adjacent field on that edge.
BUT note that the margins of adjacent fields overlap, so that if field A has it's right margin set to 0, and right adjacent field B has it's left margin set to 20, then the two fields will still be placed no closer than 20 pixels apart.
i.e. you have to take into account the margins set for the edges of all adjacent fields.
Returning to padding, the same applies for managers if you set their internal padding. This will determine how close to the inside of the manager's border an included field can be placed.
Somewhere in the blackberry documentation and/or support forum, there is a document explaining this pictorially, I just can't find my link to it right now, but will post it here when I find it again.

Resources