Button with explicit caption in FormLayout


I have a FormLayout with some textfields but also a button in one row. I would like to have an explicit caption in front of the button which is at the same position like the captions of the textfields. Since the button class will put the caption in the button I cannot use “setCaption()”. Putting a label with the caption and the button in a HorizontalLayout won’t set the label and button at the right position. Any ideas?

Replace FormLayout with two-column GridLayout. Put the fields in the second column. Take out all setCaptions and put them into Labels that you put into the first column. Not the nicest option to code, but works.