eclipse-scout / scout.rt

https://www.eclipse.org/scout/
Eclipse Public License 2.0
34 stars 39 forks source link

Not implemented Function getConfiguredLabelHorizontalAlignment #1221

Open BjoernDroste365 opened 3 days ago

BjoernDroste365 commented 3 days ago

The function getConfiguredLabelHorizontalAlignment has no effect if it is configured with constants such as LABEL_HORIZONTAL_ALIGNMENT_RIGHT.

This function is not implemented in the @eclipse-scout library for JS or for the user interface in general. The method should move the label from left to right in the case of a StringField, for example. It is important that the settings for the label positions, for example LABEL_POSITION_TOP, can be combined with the alignment settings.

Method to configure

@Override
protected byte getConfiguredLabelHorizontalAlignment() {
  return LABEL_HORIZONTAL_ALIGNMENT_RIGHT;
}

This is how it should look. From: Label-Left To: Label-Right

cguglielmo commented 2 days ago

Thank you for reporting it. It is true, the functionality has never been implemented yet because there was no need for it. Can you explain why you need it? Your expectation of how it should look is not quite correct. Setting the label alignment to LABEL_HORIZONTAL_ALIGNMENT_RIGHT would not move the label to the right of the field. Instead, it would right align it on the left side of the field. This is how it would look like: image

BjoernDroste365 commented 2 days ago

But if I use LABEL_POSITION_ON_FIELD as the label's position and also use getConfiguredHorizontalAlignment, then the content in the input field is shifted to the right, like this:

Label-OnField-Alignment

Given this possibility of getConfiguredHorizontalAlignment, I would expect that getConfiguredLabelHorizontalAlignment would display the label on the other side.

With the getConfiguredLabelPosition method:

Label-Positions

, I would also expect that, LABEL_POSITION_RIGHT corresponds to the "Label Right" position you mentioned, or that the label position moves the label to the right side. In addition, I would like to note that LABEL_POSITION_BOTTOM apparently makes no difference to "Right" and I would have assumed that "Bottom" would be under the input field.

I specifically wanted to use these setting I explained and showed, for UiDeviceType.MOBILE. Since the screen is taller than it is wide, I wanted to use the LABEL_POSITION_TOP setting and the alignment mentioned to move the label to the right side, so that two fields are next to each other and the labels are each above the input field at the edge, and not one label at the edge and the second somewhere in the middle. Since the fields have a configurable label, I had thought that it could be moved to the other side. Also because the additional insertion of two LabelFields to achieve my solution is, in my opinion, not as nice as my original idea.