Tabbed Panels/Tabs via Resource Strings

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

bdeshazer

Tabbed Panels/Tabs via Resource Strings

Post by bdeshazer »

Is it not possible to create Tabbed Panels and Tabs using a resource string?

On both CS5 and CS6 this works:

Code: Select allvar win = new Window ("dialog","Tab Test");

win.matchtabs=win.add("tabbedpanel");

win.matchtabs.taba=win.matchtabs.add("tab",undefined,"Match #1");
win.matchtabs.tabb=win.matchtabs.add("tab",undefined,"Match #2");

win.show();


but this:
Code: Select allvar res= "dialog { matchtabs: TabbedPanel { taba: Tab { text: 'Match #1' }, tabb: Tab { text: 'Match #2' } } }";

var win = new Window (res,"Tab Test");

win.show();


fails with "Error 19: ... TabbedPanel is not an object" , again both on CS5 and CS6.

Thanks for any insight.

Brent

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

bdeshazer

Tabbed Panels/Tabs via Resource Strings

Post by bdeshazer »

Couldn't get this to work and needed to move forward, so I switched to using a couple of radio buttons to select groups arranged in a stack. Not as visually appealing IMHO but it accomplished the task at hand.

Strange that you can't create these with resource strings. I could have switched to the "other" method for creating these using the "add" methods, but if you're being descriptive at all for your controls you can end up with some very long lines of text and either a lot of typing or a lot of long copy/paste operations.

Resource strings just seem much more elegant and easy to create, is there any reason (besides this one) that I should get in the habit of using the "add" method instead?
Mike Hale

Tabbed Panels/Tabs via Resource Strings

Post by Mike Hale »

Sorry I couldn't help with this but I feel the opposite about resource strings. I find that they may be ok for a very simple dialog but doing it the 'other' way is far easier to edit and add controls if needed.

You can also do things like( the dialog is not pretty but this does show how to make shortcuts to dialog controls )
Code: Select allvar win = new Window ("dialog","Tab Test");
var tp =win.add("tabbedpanel");
tp.taba=tp.add("tab",undefined,"Match #1");
win.cbOptionOne = tp.taba.add('checkbox',undefined,'some option');
tp.tabb=tp.add("tab",undefined,"Match #2");
win.cbOptionTwo = tp.tabb.add('checkbox',undefined,'some other option');
win.show();
alert(win.cbOptionOne.value);
alert(win.cbOptionTwo.value);
bdeshazer

Tabbed Panels/Tabs via Resource Strings

Post by bdeshazer »

No worries Mike, you've helped me so much directly and indirectly in the past that I'll let this one slide

I guess resource strings just comes down to personal preference, when properly formatted I find them extremely easy to work with. The dialog for this particular script was one of the more complicated ones I've created, but it was far easier for me to adopt the approach I did and use resource strings than trying to get the Tab panel working using the other method.

I did make an attempt to use the other method but just found it to be a drag, and it would have been my only script that used this method, so I took a breath and said "how else can I accomplish this?" and came up with the radio button/stack method.

To each their own is my motto!
bdeshazer

Tabbed Panels/Tabs via Resource Strings

Post by bdeshazer »

fyi, got a reply from a poster over on the Adobe scripting forum:

http://forums.adobe.com/message/4680041

Solution appears to be this:

Code: Select allres = "myTabbedPanel: Panel{type:'tabbedpanel' \
myTab: Panel{type: 'tab', text: 'Tab Title'},  \
}";