Centering a checkbox without a caption inside a TGridPanel - delphi

Searched all over Google and I'm afraid I can't find an answer to this.
Here is my current situation:
Instead of having those checkbox aligned to the left I want them centered like so (photoshopped obviously):
Anybody know how to achieve this with VCL? Thanks.
Edit:
These components are inside a TGridPanel and for whatever reason the Left and Top properties have no effect on the position of the component in the cell. I have also looked for any layout properties with no luck.

The controls inside the TGridPanel are automatically center-aligned. If you reduce the width of the checkboxes to the correct value it should be centered as requested. Be aware that if you reduce the size too much the checkbox will shrink.

I managed to find a solution although it's rather messy. But for future reference I had to create a panel for every single cell in my GridPanel then that allowed me to set the left padding property of the panel to push my TCheckboxes over.
Yes it's super inefficient but it's the best I've got so far. Also fixes my issue of wanting to show the cell outlines inside the GridPanel.

Related

HorizontalSplitPanel - Adjust the splitter position based on component width

Is there a way to add more than 2 components in HorizontalSplit panel without nesting it?
Splitter position should be based on the space allocated for the component. There is nesting of horizontal split panel but the splitter position is not set based on the component visible space
If you want a separate resizable split area for each of those components, then no, you cannot do that with just one split panel and nesting is indeed the solution. If you are fine with just one split, then you can add a layout instead of a component and just keep inserting more components to the layout.
You can use splitPanel.setSplitPosition for adjusting the split position. If your desired split position isn't static and your contents don't have fixed sizes, you could possibly use a tool like SizeReporter add-on for querying the content sizes. Note that this will undeniably cause some flickering, because you need to add the component to the layout before you can measure its size.
A horizontal splitpanel allows one component on the left and one on the right side.
Nothing more
What do you want to achieve?
If you add two layouts to HorizontalSplit there is nothing stopping you in adding more than one component to those layouts. You can also add new SplitLayouts to existing splitlayouts if you want that.

How do I change the scroll behaviour of TDrawGrid

The TDrawGrid component has a standard way of determining how much to scroll when you scroll to the right and left for example. I want the same behaviour as with a TScrollBox. The amount scrolled to the right and left is a lot less and you can control that. I was using a TScrollBox for this exact reason until I figured out that I can't have fixed Rows and Fixed Cols anymore because my ScrollBox determines the scrolling.
Is there a short way to do this without creating my own component?

How do I move a control in Vaadin designer without changing which component it is a child of?

I am trying to use the latest Vaadin Designer (v8) to layout a bunch of controls in an absolute layout. I also have a horizontal layout that is on the same layout.
My problem is I just want to move a label to an absolute x,y position within absolute layout. I know I can achieve this by hand or by nudging the label to the x,y I want with the arrow keys. When I try to drag it onto the layout however this happens.
Perhaps there is no way to do this. I was thinking there should be a feature like holding down alt-key while dragging keeps the control within its current layout?
You are completely right. You can achieve it by using arrow key or Position property (if you are in an AbsoluteLayout) but currently, there is no way to do that by dragging the components.
Whenever you drag some components over a layout, it will be always hooked into that layout.
Your suggestion about using ALT-key to avoid this problem is very nice. The team would very much appreciate if you can fill in an issue (https://github.com/vaadin/designer/issues/new) as a feature request/improvement which we can consider later on.

Laying out subviews in a UITableViewCell dynamically

This is the most complicated UI related problem I've come across yet. I've been trying to find a solution for literally weeks but no avail. Let em explain.
In this app I'm working on, I need to display a certain list. It's actually a schedule. Here's how it should look like,
The fields circled by red circles don't change. To explain what change means I have to show you this.
Its a set of filters which the user can show/hide certain fields and the ones that are circled in the first image are static ones. They can't be toggled on and off.
Now the problem arises with the ones that can be toggled. Here's what it looks like if you turn off the Show Actions flag.
A new label with a blue background replaces the bottom one you can see in the first image.
Here's another one where you disable Show Time option and the time labels are gone (yes it affects only for some. Its expected).
If this filter list were an option list, it would have been easy. Just create a custom cell for each option and you're good to go. But unfortunately the user is able to toggle multiple filters! For example the user can turn off both Show Actions and Show Time and it'd look like the last image but the bottom label would have the blue label in the third image.
To top it all off, the cells' height is dynamic. In iOS 8 creating self resizing cells are easy enough from the IB when you could just add auto layout constraints and done.
But it seems to me that creating these cells from the IB isn't an available option to me. Simply because there are way too many filter combinations a user can make. So the cell's subviews need to adjust to it.
My question is how can I create a dynamic cell like that? My best guess is through code, right? I haven't written my UI in code before so I tried creating a test project to familiarize myself with it. But the problems I'm facing is setting fixed frame sizes makes the dynamic nature obsolete. And how can I move a view to fill up a removed view's space (Last image. Time labels are gone so the name and the id labels move to the left to fill that space).
I know this question is a little too broad. I'm not asking for a straight answer either. I'd really appreciate some pointers, or even a better suggestion on how to approach this because I'm truly at the rock bottom on this issue.
Thank you.
It's hard to give you any precise help since your question is so broad. First, I would recommend watching the 3 videos on Auto Layout from the WWDC 2012 (sessions 202, 228, and 232).
To answer your one example, how to move a view to replace a view that's removed. You would need to make two left edge constraints from the view with the text (Kund Alof...). One with a constant of 0 to the time label with a priority of 1000 (that's the default), and another to the left edge of the cell, also with a constant of 0, but with a lower priority, say 900. As long as the time label is present, the constraint to it will determine the position of the text label, but when it's removed, the lower priority constraint to the left edge will take over and move the label over to the left edge.

NSButton Aligned to the Right

I want to have a check box, like the standard one (first the check box and on the right its title) but I want it to be aligned from the right. If I change the alignment to the right then only the text will move to the right but the button itself will still be at the left.
How would I achieve this without knowing the bounds of the NSButton?
Read about Interface Layout in the Interface Builder user guide. As it turns out, just make your checkbox as big as you need to initially, and then set the struts and springs to make it resize correctly as it changes.
To do the same thing in code, read about the setAutoresizingMask: method in NSView.

Resources