How to use VHorizontalLayout?

Hello, i’m newbie. I want to do this:

| VTextField | VButton |
--------------------------------------------------- using VHorizontalLayout widget. How can i implement?

Now my result is like this,

VTextField
VButton

Here is the code,


    VHorizontalLayout horizontal = new VHorizontalLayout();
    horizontal.setWidth("100%");
    
    VTextField email = new VTextField();
    
    VButton button = new VButton();
    button.setText("Save");
    
    horizontal.add(email);
    horizontal.add(button);

    layout.add(horizontal);

Thank you. Sorry for my english.

VHorizontalLayout horizontal = new VHorizontalLayout();
horizontal.setWidth(“100%”);

VTextField email = new VTextField();

VButton button = new VButton();
button.setText(“Save”);

[b]
Slot eSlot = horizontal.getSlot(email);
eSlot.setExpandRatio(70);
Slot bSlot = horizontal.getSlot(button);
bSlot.setExpandRation(30);

horizontal.addOrMoveSlot(eSlot , 0, false);
horizontal.addOrMoveSlot(bSlot , 1, false);

horizontal.updateExpandedSizes();
horizontal.updateExpandCompensation();
[/b]

layout.add(horizontal);

Mário Korčák, you are my hero :slight_smile: thank you.

i’m glad that i helped :slight_smile: