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.
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
Copy link to clipboard
Copied
Yeah I'm pretty confident photoshop is the right place.
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.
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.
Copy link to clipboard
Copied
Can you show examples of exactly what you want to do, and what you're getting now?
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();
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.
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.
Copy link to clipboard
Copied
I don't quite understand how this addresses what I asked about alignment issues.
Copy link to clipboard
Copied