There is a panel with anchor layout used for vertical sizing.
Inside the panel there is a horizontal buttongroup.
Is there a way to set fixed width or better make the width depend on buttons?
In my case it is always stretched to the size of the window.
There is the same problem with the grid inside the panel.
Thank you.
Making the width dependent on the buttons is handled by the layout itself. If you have an hbox layout, each of the items inside the container (say, buttons) will automatically occupy the width.
Related
I'm trying to build a screen where there is a fixed widget at the top of the screen and another widget which is fixed to the bottom of the screen and in between is a scrollable widget.
I want to have the content inside the scrollable widget scroll underneath the two fixed widgets (both with a transparent blur), to indicate that there is more content underneath.
Here is an image of what I am trying to do.
I am currently using a Stack for this, however I am having to manually adjust the padding in the SingleChildScrollView to offset for the top and bottom widgets, but I would like to have this be much more flexible and have the widgets be any size and not have to update the padding.
I've found other examples where the bottom widget is part of the scrollable content but that isn't quite what I am looking for.
Does anyone know of a way to do this, without having to manually provide the padding?
I have a Vaadin 8 application with several views.
public class ViewName extends Panel implements View {
There is a VerticalLayout as main layout in the panel.
public ViewName() {
setSizeFull();
VerticalLayout mainLayout = new VerticalLayout();
setContent(mainLayout);
Then I have many different layouts (HorizontalLayout, GridLayout) or Components such as Label being added as components to the mainLayout. For the HorizontalLayouts I often do the following to use the full width of the screen:
hLayout.setWidth("100%");
I have a lot of icons, grids etc. Everything is OK as long as I don't resize the window.
When I resize the window to a small size I get a mess (icons, text etc. on top of each other) and no horizontal scrollbar. (However, the grids get horizontal scrollbars.) I have tried many things to fix this. If I add
mainLayout.setSizeFull();
or
mainLayout.setWidth("100%");
I have a mess on the big screen already. I also tried the CSS for the mainLayout as described here. I get several scrollbars but none for the window itself!
The only component that resizes correctly is a Label added to the mainLayout, e.g.:
Label title = new Label("Some text",ContentMode.HTML);
title.setWidth(100, Unit.PERCENTAGE);
mainLayout.addComponent(title);
mainLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
I also noticed that anything in a GridLayout seems to stay in place after resizing but is not vissible since I have no scrollbar. However, icons in a HorizontalLayout get on top of each other.
What is wrong? Please, I need a general instruction on which layout I should use as main layout for my view panel, how to size the components and how to get ONE horizontal scrollbar for the main window if necessary.
The problem is that you are setting the width of your mainLayout to the width of your view. This means, that your mainLayouts width will never be bigger than your views width. So no scroll bar will appear.
According to the information you posted, changing your mainLayouts width to undefined should fix the problem.
mainLayout.setWidth("-1px");
I have a QHBoxLayout, and it has 2 QVBoxLayouts on it one near the other.
Each layout has widgets, and I wonder how to make this layout resizable (the user can change the width) ?
Use a QSplitter. Create a couple of top-level container widgets for your vbox layouts, and then use the splitter's addWidget method to add the widgets to the splitter. The splitter's orientation is horizontal by default, so the vboxes will appear side by side.
I'm having a single Parent Panel, which has 2 child panels. One has content dynamically created, while the other is fixed height and width. The Parent panel is using border layout, with center and east regions defined. I'm trying to get autoscroll to trigger on the parent panel when there is an overflow on on the center region panel. I've set the autoscroll option to true to the parent panel, but everytime there is an overflow on the center panel, it just gets cuts off. When I'm adding an overflow to center region panel, i get a scrollbar for that panel alone. I don't need that, but rather I want it on the entire Parent Panel. Let me know if anyone has any suggestions..
This issue is usually a result of over-nesting Panels, and/or one or more Panels in the layout not having a layout config specified. Some layout configuration code would help.
Here is my view from what I understood.. You have two panels that go into the center region of the border layout.. and you need a scroll bar for the center when one of the panels overflow.
Here is how I worked out a similar situation. In my center region, I have a panel with autoScroll set to true. I have two panels added to this panel. The first is fixed height (its a grid) and second is panel (displayed below the grid) is a large form panel. Due to the parent panel having a autoScroll property set, you will have a scroll bar for the entire panel and not the second panel alone!
I don't think you can use fit layout. In fit layout, the panel will take up the whole area of its container and you will not be able to add another panel (the second panel will be hidden I suppose!).
Note: I am using the default layout (Container Layout) I do not specify any layout in my parent panel.
I have a dojo TabContainer that has a BorderContainer child, with a left region and a center region ContentPanes.
-TabContainer
-BorderContainer
-ContentPane (left)
-dojox.layout.ContentPane (center)
I have it setup so that the left ContentPane is collapsible (by replacing it with a slimmer ContentPane) which works fine. However, the idea of this functionality is to make the center (dojox.layout.ContentPane) region wider but when the left pane is collapsed to the slim one, the center region stays the same width.
Now I know I can call refresh() on the center ContentPane but this also refreshes the content as the center ContentPane is retrieved via href - which I don't what as it loses changes to form data.
So how do I get the center ContentPane to refresh it's layout without manually figuring out the proper width and calling resize()?
Or could you use dojox.layout.ExpandoPane. It's a ContentPane that has a 'click to minimise' ability.
how are you replacing the left pane? Are you using addChild/removeChild methods? How about just changing the widthof the left pane rather than replacing it?