Skip to main content
YuK1_Works
Inspiring
September 4, 2023
Answered

How to center the text in EditText and StaticText

  • September 4, 2023
  • 1 reply
  • 684 views

I am writing a jsx script.

When I dynamically rewrite StaticText, the text is aligned to the left.
I believe this is because the alignment of the text in StaticText is left-aligned (like Paragraph in the text layer).
The same is true in EditText. The text is drawn left-aligned to the bounding box.
Is there any way to center this?

 

This topic has been closed for replies.
Correct answer Arie Stavchansky

You can use a `justify` property value of `center` for the EditText fields.

 

Be aware that ScriptUI is on its way out for being supported.  I'm not saying stop writing your code, but just be aware that ScriptUI is buggy from the UI layout perspective.  Some documented things simply to not work.   ScriptUI is something you have to just take as it comes.  

 

Most developers have moved into CEP and UXP which is what Adobe will officially support moving forward.  While I don't have any official word from Adobe, I don't think they plan on deprectating ScriptUI fully but you should be aware that it has stopped being supported.

 

1 reply

Arie StavchanskyCorrect answer
Legend
September 4, 2023

You can use a `justify` property value of `center` for the EditText fields.

 

Be aware that ScriptUI is on its way out for being supported.  I'm not saying stop writing your code, but just be aware that ScriptUI is buggy from the UI layout perspective.  Some documented things simply to not work.   ScriptUI is something you have to just take as it comes.  

 

Most developers have moved into CEP and UXP which is what Adobe will officially support moving forward.  While I don't have any official word from Adobe, I don't think they plan on deprectating ScriptUI fully but you should be aware that it has stopped being supported.

 

YuK1_Works
Inspiring
September 4, 2023

Thank you!