Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiline text alignment in UI

Advocate ,
Apr 13, 2014 Apr 13, 2014

Hi guys. Newby here. Sorry if this is silly questtion, but I am getting bold solving this with no prevail.

I have a multiline text. But it's aligned to the left. Any way to center align it?

<CODE>

var aboutWin = new Window("palette", "About", undefined);

var st = aboutWin.add("statictext", undefined, "", {multiline: true } );

st.text = "Some long long long text paragraph here";

st.characters = 30;

</CODE>

How do I center align it?

Thank you.

TOPICS
Scripting
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Apr 13, 2014 Apr 13, 2014

You can modify the values... for instance

st.justify = 'center';

Translate
Advocate ,
Apr 13, 2014 Apr 13, 2014

You can play with the container's margins (here: the window), the alignment of the text with respect to its container, and its justification.

Xavier.

var aboutWin = new Window("palette", "About", undefined);

aboutWin.margins = [40, 20, 40, 20];

var st = aboutWin.add("statictext", undefined, "", {multiline: true } );

st.text = "Some long long long text paragraph here";

for (var k=0; k<4; k++) st.text+=st.text;

st.alignment = ['center', 'top'];

st.characters = 30;    // fixes the width of the text, not its total length

st.justify = 'left';

aboutWin.show();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 13, 2014 Apr 13, 2014

emm, not sure that this is what I am after. This mothed seems to center entire text block to the center of the window. However, I only need the text itself to be center aligned in that block. Does this makes anmy sence?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 13, 2014 Apr 13, 2014

You can modify the values... for instance

st.justify = 'center';

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 13, 2014 Apr 13, 2014

Yes, oh man, I was probably blind. I did tried that method, but it didn't work:)

Now it works. Thank you for reminding me this:)

However, oddly enought, this doesn't work in CS3. CS4 and above seem to obey the justification.

Any ways, thanks for input.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2018 Jun 24, 2018

test some codes using justify , works on estk , but not works on ae 2018

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 25, 2018 Jun 25, 2018
LATEST

Yeap, I think it broke in CC version. No more justification

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines