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

How to align text within an EditText?

Advocate ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Hello,

using this simple one as an example:

var w = new Window('dialog');

w.preferredSize = [200,100];

w.et = w.add('edittext', void 0, "Some text");

w.et.preferredSize.height = 40;

w.show();

The "Some text" is placed top-left in the EditText - is it possible to control its alignment, i.e. ['center', 'middle']?

(just to be clear, I'm not interested in the EditText position within the Window, but just the text within the EditText itself).

Thank you!

Davide Barranca

www.davidebarranca.com

TOPICS
Actions and scripting

Views

803

Translate

Translate

Report

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
Adobe
Community Expert ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Davide, use the below example with either left, center, or right.  You have to have the justify line right after the line that creates the edittext box:

#target photoshop

var dlg = new Window('dialog','test')

dlg.txt = dlg.add('edittext',undefined,'this it the text');

dlg.txt.justify = 'center'

dlg.txt.size = [200,60]

dlg.show()

Votes

Translate

Translate

Report

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 ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

Hello Chuck,

thanks for the tip! Actually, I'm mostly bothered by the vertical alignment (top / middle / bottom) - since afaik I can't set any padding for the edittext I use to use bigger-than-default heigth - the only problem is that the text sticks on the top of the box, while it would be better looking if centered, along the Y axis.

Davide

Votes

Translate

Translate

Report

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 Expert ,
Sep 30, 2013 Sep 30, 2013

Copy link to clipboard

Copied

LATEST

I don't think there are controls for that.

Votes

Translate

Translate

Report

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