dlangui icon indicating copy to clipboard operation
dlangui copied to clipboard

How to align widget

Open FabArd opened this issue 2 years ago • 3 comments

Hi,

How to align the "send" button on the right side of the "MDI" groupbox ? All my attempts have been unsuccessful ! Thanks.

DmlEdit

GroupBox {
    text: "MDI"
    TextWidget {text: "Manual Command"}  
    EditLine {layoutWidth: 350}
    HorizontalLayout {
        Button {text: "Send"}
    }
}

FabArd avatar Nov 14 '22 15:11 FabArd

Hi! I would suggest creating an empty widget that takes all the extra space, eg:

GroupBox {
    maxWidth: 500px
    text: "MDI"
    TextWidget {text: "Manual Command"}
    EditLine {layoutWidth: 350}
    HorizontalLayout {
        VerticalLayout { layoutWidth: fill; minWidth: 10% }
        Button {text: "Send"}
    }
}

Note the extra "maxWidth" in the GroupBox. Without it, the widget becomes very long for some reason

GrimMaple avatar Nov 15 '22 16:11 GrimMaple

You have enabled me to find another solution :

GroupBox {
    text: "MDI"
    TextWidget {text: "Manual Command"}  
    EditLine {layoutWidth: 350}
    HorizontalLayout {
        HSpacer {layoutWidth: fill; minWidth: 350 }
        Button {text: "Send"}
    }
}

FabArd avatar Nov 15 '22 18:11 FabArd

I think the best solution is :

GroupBox {
    text: "MDI"
    TextWidget {text: "Manual Command"}  
    EditLine {layoutWidth: 350}
    HorizontalLayout {
        layoutWidth: fill
        HSpacer {layoutWidth: fill }
        Button {text: "Send"}
    }
}

This solution do not modify the "EditLine" dimension.

FabArd avatar Nov 15 '22 19:11 FabArd