Use HorizontalLayout
on the parent container. Create HorizontalLayoutData
with percentWidth
set to 100
. Pass that to the value label's layoutData
property. The first label will fill as much space as it needs to display its text. The second label will fill the entirety of the remaining space.
Basically, percentWidth
isn't strictly a percentage of the parent container's width. Instead, it's a percentage of the parent container's width minus the widths of all children that aren't also using percentWidth
.