Skip to content

Rendering issue in the Alcinoe FMX memo/edit component #509

Description

@Lars-Delphi

Hello,

I found a rendering issue in the Alcinoe FMX memo/edit component.

The problem occurs when using TALMemo with an inline label and setting the control to disabled.

Configuration:

Memo.LabelText := 'Address';
Memo.LabelTextSettings.Layout := TALBaseEdit.TLabelTextLayout.Inline;
Memo.Text := 'Rosentalweg 123'#13#10'90598 Leipzig Sachsen'#13#10'Deutschland';
Memo.Enabled := False;

Expected behavior:

The memo text should be rendered below the inline label, exactly like it is when Enabled = True.

Actual behavior:

When Enabled = False, the label text and the memo text overlap. The memo content is drawn at the top of the control and partially covers the inline label.

The issue does not appear when Enabled = True.

After debugging, the cause seems to be in Alcinoe.FMX.Edit, not directly in Alcinoe.FMX.Memo.

In TALBaseEdit.ShouldHideNativeView, the native view is hidden when the control is disabled:

result := (not Enabled) or ...

Because of that, the actual text is no longer displayed by the native memo/edit view. Instead, it is rendered through the fallback canvas path in TALBaseEdit.Paint, inside the PromptText drawing section.

That fallback path does not correctly account for LabelTextSettings.Layout = Inline. It positions the rendered text at the top of the native view bounds, while the inline label is also drawn there. This causes both texts to overlap.

A possible fix is to adjust the fallback text position in TALBaseEdit.Paint when:

not Enabled

and

LabelTextSettings.Layout = TLabelTextLayout.Inline

In that case, the prompt/text drawable should be positioned below the inline label, for example using the bottom of LLabelTextDrawableRect plus the label margin.

Example fix idea:

if (not Enabled) and (LabelTextSettings.Layout = TLabelTextLayout.Inline) then begin
  LPos.Y := Max(
              LNativeViewBoundsRect.Top,
              LLabelTextDrawableRect.Bottom + LabelTextSettings.Margins.Bottom);
end
else begin
  case TextSettings.VertAlign of
    TALTextVertAlign.Center:
      LPos.Y := LNativeViewBoundsRect.Top +
                ((LNativeViewBoundsRect.Height - LPromptTextDrawableRect.Height) / 2);

    TALTextVertAlign.Leading:
      LPos.Y := LNativeViewBoundsRect.Top +
                ((GetLineHeight - LPromptTextDrawableRect.Height) / 2);

    TALTextVertAlign.Trailing:
      LPos.Y := LNativeViewBoundsRect.Top +
                LNativeViewBoundsRect.Height -
                LPromptTextDrawableRect.Height -
                ((GetLineHeight - LPromptTextDrawableRect.Height) / 2);
  end;
end;

This keeps the disabled fallback-rendered text aligned below the inline label instead of drawing it over the label.

Best regards,
Lars

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions