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

Label controls?

New Here ,
Sep 29, 2020 Sep 29, 2020

Copy link to clipboard

Copied

In building a UI with multiple sliders, is there a way to label them directly in such a way that the names automatically center off to the left/right side? Otherwise I need a very cimplicated group structure that doesn't even fully work. 

TOPICS
Actions and scripting

Views

430

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 29, 2020 Sep 29, 2020

Copy link to clipboard

Copied

Are you in the right place?  This is Photoshop, not the XD community.

https://community.adobe.com/t5/adobe-xd/bd-p/xd

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

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
New Here ,
Sep 29, 2020 Sep 29, 2020

Copy link to clipboard

Copied

Yeah I'm pretty confident photoshop is the right place. 

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 29, 2020 Sep 29, 2020

Copy link to clipboard

Copied

I'm pretty sure you have to create the groups to set the alignment and centering of the slider lables, unfortunately. That is if you'e using the auto UI feature. If you manually type in all the control and text positions, then no, but that's not really automatic, and a PIA.

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
New Here ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

I'm also pretty sure I have to create groups and have been using them already, but they do not align properly in photoshop, that is why I would like to try placing text manually. 

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

Copy link to clipboard

Copied

LATEST

Can you show examples of exactly what you want to do, and what you're getting now?

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
Guide ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

Perhaps I misunderstood the question, but you can create a function or object with the combination of elements you need and then use it to add many instances of the same type of elements.
(the code is not very elegant, just an example)

#target photoshop
// DIALOG
// ======
var dialog = new Window("dialog");

for (i = 0; i<10; i++) {addSlider (dialog, 'slider '+ i)}

function addSlider(parent, label, min, max) {
    var g = parent.add("group");
    g.orientation = "column";
    g.alignChildren = ["fill", "center"];
    g.spacing = 0;
    g.margins = 0;

    var g1 = g.add("group");
    g1.orientation = "row";
    g1.alignChildren = ["left", "center"];

    var statictext1 = g1.add("statictext");
    statictext1.text = label;
    statictext1.preferredSize.width = 100;
    statictext1.justify = "right";

    var d = g1.add("statictext");
    d.text = min ? min : 0;
    d.preferredSize.width = 20;
    d.justify = "right";

    var s = g1.add("slider");
    s.minvalue = min ? min : 0;
    s.maxvalue = max ? max : 100;
    s.value = 50;
    s.preferredSize.width = 150;

    var u = g1.add("statictext");
    u.text = max ? max : 100;

    var g2 = g.add("group");
    g2.orientation = "row";
    g2.alignChildren = ["right", "center"];
    g2.spacing = 10;
    g2.margins = 0;

    var c = g2.add("statictext");
    c.text = "0";
    c.preferredSize.width = 220;
    c.justify = "center"; 

    s.onChanging = function () {
        c.text = this.value
    }
}
dialog.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
Community Expert ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

I've done something along those lines. I needed to create a UI similar to the batch rename UI in Bridge, where the user could add rows of new controls. Had to define the controls to an array and keep track of them that way. 

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
Guide ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

I've also done something similar. It's actually quite simple - each line permutes a group of individual elements. Some of the elements are standard, some are described by composite objects, the appearance and behavior of which is described by a function. You have complete control over this object in any way you like - from received values to return values.2020-09-30_17-19-05.png2020-09-30_17-19-19.png2020-09-30_17-19-051.jpg

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
New Here ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

I don't quite understand how this addresses what I asked about alignment issues. 

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
People's Champ ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

Have you run the script?
There, the slider with the label will be created in one line of code.
 
The slider itself does not have a label. You have to create something like statictext.
You can align text using properties such as "alignment", "justify", as well as using groups.

You got an abstract answer to an abstract question.

If there will be a specific code that does not work for you, there will be a specific answer.
 
 
 

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