0
votes

I have a "grid" of different fields in Scout Neon (M5) application. My problem is that String and number (BigDecimal for example) fields has different text position in field.

In String field, text is positioned on left side, and in BigDecimal (and other number fields) text is positioned on right side. I understand why by default this is a case, but in grid layout it really doesn't look good.

enter image description here

How to change text position in fields?

1

1 Answers

2
votes

Just set the property horizontalAlignment to -1.

public class IntegerField extends AbstractIntegerField {

  @Override
  protected int getConfiguredHorizontalAlignment() {
    return -1;
  }

}

It is not obvious though because the javadoc says that this property configures the horizontal alignment of the field inside a group box. This is is true as well, but only if fillHorizontal is set to false.

So currently the property is used for 2 purposes:

  • Controlling the alignment of the field in a grid cell, if fillHorizontal is false
  • Controlling the alignment of the content of the field, which is what you need