HorizontalSplitPanel - Adjust the splitter position based on component width - vaadin

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.

Related

Delphi Resizing Form messes up components

I created my form and it looks fine in the standard size when ran with the program, however when I maximize the form, the components get messed up. I anchored the components on the left and right, however a giant gap is created in the middle of the form and I don't know how to fix it. When in the 'Design' view of the program, all my components are touching from me trying to fill the middle gap. I tried aligning, anchoring and searched online for a while with no luck. Any clue?
Form in standard size upon running program:
Form in full screen with giant middle gap:
From the form's OnResize event, you can compute the width and left property values for the component to fit the new size. You can adjust the width of components or distribute the distance between components to get the look you want. Or a combination of the two.
It is also possible to put the components on two lines if the form's width becomes too small. Or use a scroll panel so that the user can scroll to see what is not possible to show correctly given the width.
All that requires coding. Parts can be done using panels and align the panels.

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.

Centering a checkbox without a caption inside a TGridPanel

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.

Text and Image together in a fixed width overflowing-column component in iOS

I want to combine text and images in a view (not using UIWebView) and I want to make the content appear according to the width of the inner view predefined by me. If it's content overflows the content size of that inner view, I want it to overflow to the next view (column right next to the previous one).
Summary: I want to combine both text and images like a newspaper page; fixed width columns all next to each other.
I am trying to create a custom UIScrollView but it becomes more complex in every step and I don't feel safe about this method.
I am using RichTextBlock component in Windows 8 where I can easily add Text or Image objects. I hope to find a similar component but I still haven't.
Are there any other easier methods or ready-to-use libraries made for a similar thing?

Smooth scroll string grid

I need a string grid which can scroll smoothly, as opposed to locking in the top row / left col positions. When you scroll a TStringGrid, the left visible column and top visible row snap into position along the top/left edges. I need the ability for the user to scroll smoothly, not locking these edges into place.
I wouldn't think this is possible to modify in the VCL TStringGrid (or TCustomGrid for that matter) because it relies on properties such as TopRow, LeftCol, VisibleRowCount, etc.. I'm pretty sure I'll need a third party control, but I'd love to use the TStringGrid if possible, because I already have a lot of code wrapped around it. If I do need a third-party grid, then I'm hoping it works closely enough like the TStringGrid.
The short answer is no, you canĀ“t pixel scroll a TStringGrid. You can simulate a grid using a TScrollBox. You can put a grid inside the TScrollBox, make the grid large enough to fit all rows and cols, and turn off its scroll bars, but some things like keyboard navigation will not work.
Other alternative is to use the TVirtualTree in grid mode or TListView. Both have this pixel scroll you want.
I was looking for something similar. Unfortunately, you can't do it with Borland's code but Lazarus can do it
Scrolling the TStringGrid pixel by pixel
You may want to take a look in their code.

Resources