Use of newline character sequence (backslash n) in UI Button Text

I have seen the thread:
button-text-formatting

Still I cannot sort out whether or not (or under what conditions) this is meant (can be expected) to work.

I am unable to get \n to generate a new line on Button Text as it does on Label Text.

Is there a parameter that can be set via an extension? Evidently, if Text Input Type "is set to TYPE_TEXT_VARIATION_PERSON_NAME then it does not allow multiline support". (from referenced post).

Is there some other type of extension that will solve this? such as a Button extension?

Any comments or help in pointing me in the right direction will be greatly appreciated!

Kind regards,
-Randal

Works on a Samsung A13 Android 13.

Hello\nWorld results in
Hello
World

in a Button while using any of these Themes
works

Are you using an ios device?
Are you using Companion 2.68?

Thanks for the test result ... I am on an older deivce/OS:
moto e5 play, Android 8.0.0, using theme Device Default.

And yes, I am using Companion 2.68.

What do you suggest (besides upgrading my phone? :slight_smile:

[addendum]

Using the TestInputType extension from the referenced post:

Doit result is "0".

Don't use multiple line Buttons. Inability to use multiple lines might be a bug specific to your device so use a different way to display using a different component; put text in an image and display that in the Button; use a Label or a ListView etc.

Did you change other Button Properties? For instance Shape. Or set Height to other than Automatic?

... AND even if it is not (a device specific bug), based on what I am reading from you and the other post, it COULD be. And if I expect the app to work on other devices then (as you suggested in line 1), I should not depend on multi-line Button text.

A label is what I WAS using ... I need the multi-function button-display to conserve real estate - image & ListView - good ideas!

I may try that, but I fear that any success could be a device-specific workaround :frowning:

I am hopeful that your diagnosis and good ideas will get me there.

Thanks,
Randal

[Addendum]
I was naively expecting to find in the builtin blocks the needed conversion of "text to image" or "label to image".

Did I overlook it or does this require an extension or something else?

Well, your diagnosis was correct - and in an Occam's Razor sort of way that is embarrassing :frowning:

I increased the height of the Button and "presto!" - two lines.

The display in the Design mode showed the unformulated text as one line, e.g.:
"Line One\nLine Two"

But when executed in the app (with sufficient helght):
Line One
Line Two

Before increasing the height I had gotten:
Line One

...which should have been a clue that there was not room for the second line.

Evidently my Button needed more height than the Label that it replaced to display two lines.

I greatly appreciate your thoughtful replies.

Kind regards,
-Randal

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.