Copy link to clipboard
Copied
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.
1 Correct answer
You can modify the values... for instance
st.justify = 'center';
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
You can modify the values... for instance
st.justify = 'center';
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
test some codes using justify , works on estk , but not works on ae 2018
Copy link to clipboard
Copied
Yeap, I think it broke in CC version. No more justification

