Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Align HeaderControls

    Hi.

    I've been using headercontrols to customize one of my windows, but as in the examples:

    http://www.smartclient.com/smartgwt/showcase/#layout_windows_header_icons
    http://www.smartclient.com/smartgwt/showcase/#layout_windows_header_controls

    some of the controls are in the left and some in the right, the ones on the right move when resizing, which i can't get to work in my code. It seems that all of my controls are aligned to the left.

    Code:
            ColorPickerItem colorPicker = new ColorPickerItem();
            colorPicker.setWidth(75);
            colorPicker.setHeight(20);
    
            TextItem clusterName = new TextItem();
            clusterName.setDisabled(Boolean.TRUE);
    
            ClickHandler renameClickHandler = new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    clusterName.setDisabled(!clusterName.getDisabled());
                }
            };
    
            HeaderControl headerRenameControl = new HeaderControl(HeaderControl.DOCUMENT, renameClickHandler);
    
            DynamicForm headerColorControls = new DynamicForm();
            headerColorControls.setAlign(Alignment.RIGHT);
            headerColorControls.setLayoutAlign(Alignment.CENTER);
            headerColorControls.setLocateChildrenBy(LocatorStrategy.INDEX);
            headerColorControls.setItems(colorPicker);
    
            DynamicForm headerNameControls = new DynamicForm();
            headerNameControls.setLayoutAlign(Alignment.CENTER);
            headerNameControls.setLocateChildrenBy(LocatorStrategy.INDEX);
            headerNameControls.setItems(clusterName);
    
            Window window = new Window();
            window.setLeft(100);
            window.setTop(10);
            window.setHeight(WINDOW_HEIGHT);
            window.setWidth(WINDOW_WIDTH);
            window.setCanDragResize(true);
    
            window.setHeaderControls(headerRenameControl, headerNameControls, headerColorControls, headerSaveControl, HeaderControls.MINIMIZE_BUTTON, HeaderControls.CLOSE_BUTTON);
    So, is there a method where i can tell the headercontrols to align left or right in the header?

    #2
    Use the Watch tab to troubleshoot issues like this. Your alignment settings are being respected within your Layout, but your layout as a whole is small and has been given the default alignment. Make it larger and you will be able to use LayoutSpacers and/or alignment settings in it's interior.

    Comment

    Working...
    X