onChange dropdownlist changes?
I use a drop-down list to make a selection and inspired while I would like the second list drop-down list to change the selection based on the election.
myStandardDown.onChange = function () {if (myStandardDown.selection == 1) {myTypeDown = ('dropdownlist', undefined, lithoNames) ;}}}}
I tried something like that and,.
this:
If (myStandardDown.selection == 0) {myTypeDown = myInputGroup.add ('dropdownlist', undefined, execNames) ;}}
or
myStandardDown.onChange = function () {if (myStandardDown.selection == 1) {myTypeDown.graphics = ('dropdownlist', undefined, lithoNames) ;}}}}
I do not know. The end result, I'm having a lot of things change based on this, therefore, is the heart of it.
I can get a text edit box to edit, but that's all.
I have three bottom of different fall he needs to change.
If you can point me in the right direction, it would be appreciated.
So I think that I figured it although if you have a better way to straighten it out feel free to post, but it works.
myStandardDown.onChange = function () {if (myStandardDown.selection == 1) {while (myTypeDown.items.length > 0) {myTypeDown.remove (myTypeDown.items [0]) ;}}}}
for (var i = 0; i)
Else if (myStandardDown.selection == 2) {while (myTypeDown.items.length > 0) {myTypeDown.remove (myTypeDown.items [0]) ;}}}
for (var i = 0; i)
else {while (myTypeDown.items.length > 0) {myTypeDown.remove (myTypeDown.items [0]) ;}}}
for (var i = 0; i)
essentially on evolution, it removes the list in the drop down in a while loop then adds a list of back with a loop according to the selection made on the changes.
Tags: InDesign
Similar Questions
-
DropDownList 'change' event trigger
I have a dilemma with a spark DropDownList I have in my application. I've got feature when the clicks (mouseUp) user anywhere in the main area of the screen, a Menu item appears. Now, the DropDownList control is at the top of the screen, and when clicked, it opens as it should. The problem is that the 'change' event fires when a mouseDown on the selection, so when the user clicks on the button down, the menu disappears and when mouse returns to the top it then triggers the Menu element, so that whenever they click on an item in the DropDownList control, the Menu just appeared immediately after.
It's extremely frustrating, so I wonder if there is a way to change the trigger for the event changes an instead of a mouseDown mouseUp. Thank you.
Why not listen to CLICKING instead of MOUSE_UP? Then this is the thing the mouse
down, has the same thing on the mouse rises.
-
How can I override method addAll in LineChart?
Hello
I need to add some statement when the methods add or addAll are called linechart. How can I do?
I thought to do a substitution the method, like this
public boolean addAll (Collection <? extends E >) {}
Return super.addAll (es);
<... a new statement... >
}
but something is not.
Instead of override the methods add() and adAll() you can add a listener:
[code]
lineChart.getData () .addListener (new ListChangeListener
() {} public void onChanged (ListChangeListener.Change extends="" series=""> ?> c) {}
//< ..some="" new="" statement...="">
}
});
[/ code]
> -
Hello
I'm trying to find a way to sync 2 lists.
Let's say I have a custom control with a method:
In the skin, the node has a method such as:ObservableList<Foo> getFoos();
In the skin, I can define a method such as:ObservableList<Bar> getBars();
In the constructor, I could add a listener like this:Bar createBar(Foo foo)
I'm particularly confused about wasReplaced, wasUpdated and many methods are not mutually exclusive.control.getFoos().addListener(new ListChangeListener<Foo>() { @Override public void onChanged(ListChangeListener.Change<? extends Foo> change) { while (change.next()) { if (change.wasPermutated()) { for (int i = change.getFrom(); i < change.getTo(); ++i) { // TODO: ??? } } else if (change.wasUpdated()) { // TODO: ??? } else if (change.wasRemoved()) { for (Foo remitem : change.getRemoved()) { myNode.getBars().remove(change.getFrom()); } } else if (change.wasAdded()) { for (int index = change.getFrom(); index < change.getTo(); index++) { myNode.getBars().add(index, creatBar(change.getList().get(index)); } } else if (change.wasReplaced()) { // TODO: ??? } } } });
And for example what events are triggered if list.clear() / removeAll() etc. are cooked? Event a change? Several? The documentation is not very clear in this regard.Looking for Bindings.bindContent (list1, list2);
(available with JavaFX 2.1)
-
Custom ItemRenderer and event Bubbling
I'm targeting Flex 4 on Air 2, but I don't think it changes the answer to this question.
I have a spark DropDownList I wrote a custom itemRenderer. In my item renderer, I have a spark.button. I have links to events in the mxml and target functions in the respective classes, and I'm listening for the dropdownlist change event and my itemrenderer.spark.button click event.
My problem is that I can't get any event in my fire element converter. It of like when I'm clicking the button, it triggers the dropdownlist.change event and destroyed the itemrenderer until it can handle the click event. So I thought that maybe I could solve this problem by adding listeners have rather than use mxml binding but same problem. Finally, I just put a trace in the click event of mxml and nothing. It does not with the item in the list before get rid you of the list.
So, simply, how to capture events itemRenderer before allowing the DropDownList change event? Or why the click through button and cause control dropdownlist to destroy?
It looks like uses DropDownList MOUSE_DOWN and no CLICK, which is why he
close the drop-down list before you get your click.
I saw a property hitAreaAdditions, you might be able to access the areas of block
close the drop-down list, but you might want to just meet MOUSE_DOWN
and stopPropagation on the event.
-
onChange and DropDownList - event not shipped
I can't get an onChange event when making a ListItem selection in a DropDownList control. I'm doing something wrong? (I am running XP Pro 32-bit)
var dlg = new Window('dialog'); var pnl = dlg.add('panel'); var myDDList1 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name: 'ddList1'}); myDDList1.addEventListener('change', myFunction); var myDDList2 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name:'ddList2'}); myDDList2.addEventListener('change', myFunction); var myDDList3 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name:'ddList3'}); myDDList3.addEventListener('change', myFunction); function myFunction(ev) { var ddl = ev.target; var props = ddl.properties; if(props.hasOwnProperty('name')) { switch(props.name) { case 'ddList1': alert ('change made in ddList1'); break; case 'ddList2': alert ('change made in ddList2'); break; case 'ddList3': alert ('change made in ddList3'); break; } } ddl = null; props = null; }; dlg.show();
It work?
var dlg = new Window('dialog'); var pnl = dlg.add('panel'); var myDDList1 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name: 'ddList1'}); myDDList1.onChange = myFunction; var myDDList2 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name:'ddList2'}); myDDList2.onChange = myFunction; var myDDList3 = pnl.add('dropdownlist',undefined,['one', 'two', 'three'], {name:'ddList3'}); myDDList3.onChange = myFunction; function myFunction() { alert (this.properties.name); }; dlg.show();
-
ListItem.selected reports false values in DropDownList.onChange
There is a bug in PS CS5 or later (still present in the CC, not in CS2) with the ListItem.selected property. It is not set correctly when you access in its list drop-down list's onChange event. However, ListItem.selection work.
Copy the following code shows a panel empty (as it shouldn't):
var dialog = new Window("dialog", "ListItem.selected bug"); dialog.orientation = "column"; dialog.ddl = dialog.add("dropdownlist", undefined, ["A", "B", "C"]); dialog.ddl.preferredSize = [40, 20]; dialog.panel = dialog.add("panel", undefined, "Options:"); dialog.panel.preferredSize = [200, 100]; dialog.panel.orientation = "stack"; var options = new Array(); var texts = ["This is A", "This is B", "This is C"]; for (var i = 0; i < dialog.ddl.items.length; ++i) { var itemOpts = dialog.panel.add("statictext", undefined, texts[i]); options.push(itemOpts); } dialog.ddl.onChange = function() { for (var i = 0; i < options.length; ++i) { if (this.items[i].selected) { options[i].show(); } else { options[i].hide(); } } }; dialog.ddl.selection = 0; dialog.center(); dialog.show();
I reported this to official channels. It would be nice if you saved it:
JS script: ListItem.selected bug in onChange
A workaround is using the DropDownList.selection property:
dialog.ddl.onChange = function() { for (var i = 0; i < options.length; ++i) { options[i].hide(); } options[this.selection.index].show(); };
-
How can I change the features of the DropDownList control?
Hello world. I want to change the DropDownList labelButton - the button which, when is knocked open the content of the list. I want to replace the empty space with a search form. User will be asked comes from the content of the DropDownList control when he types in the letters or words that match those of content. It is like a regular search but with DropDownList features and its content using results. I have no idea where to start-I already looked through DropDownListSkin and DropDownListSkinBase but can't find anything that could help.
Any ideas on that?
Any help is really appreciated!
DropDownList not ' let type you in stuff not in the list. Ensure that you
you don't want a ComboBox?
You should be able to change the skin to remove the button and call open()
When the. You'll probably need to override management and the keyboard
Well.
-
Using OnChange or OnBlur for changes the value of a hidden field
I have a need to update the value of a hidden field with the value from a menu of the list. I studied the OnBlur and OnChange JavaScript functions but can't find anything suitable. Here's the deal:
If a user selects California on a list of State menu, I need to immediately update the value of a field hidden with the "California". (Both fields are on the same page) All this must occur BEFORE the user submits the page. Each time they choose the State from the menu to list the value of the hidden field must change.
Can anyone offer any suggestions?
Thank you!
Well Yes, that did the trick for the hidden field. Thank you very much.
I'll be able to also store this value in a session variable? (see previous post)
-
Here is my code, but the thing is when I change my ddList that all objects of the Panel remain in the same place, so the thing is that I want to hide things but scrolling upward things have ordered more of my Panel.
C5 ToolKit v1.0
An after effects Script by Adrian Wülfrath
Estudio Voraz
VARIABLE CALL PARA A LAS DISTINTAS IMAGENES
var imageName0 = "_vorazimg/voraz.png";
var imagePath0 = File($.fileName).path + ' / ' + escape (imageName0);
var imageName1 = "_vorazimg/off.png;
var imagePath1 = File($.fileName).path + ' / ' + escape (imageName1);
var imageName2 = "_vorazimg/sni.png";
var imagePath2 = File($.fileName).path + ' / ' + escape (imageName2);
var imageName3 = "_vorazimg/sna.png";
var imagePath3 = File($.fileName).path + ' / ' + escape (imageName3);
var imageName4 = "_vorazimg/proyectoBtn.png";
var imagePath4 = File($.fileName).path + ' / ' + escape (imageName4);
var imageName5 = "_vorazimg/sva.png";
var imagePath5 = File($.fileName).path + ' / ' + escape (imageName5);
Voraz Explorer button
var winBrowserCmd = "C:/Program Files/Internet Explorer/iexplore.exe."
var macBrowserCmdStart = "osascript-e ' open location------" ";" "
var macBrowserCmdEnd = ' \ ' "";"
AQUI BEGINS HAS CREARSE VENTANA DEL PANEL
{
function myScript (thisObj) {}
function myScript_buildUI (thisObj) {}
var myPanel = (thisObj instanceof Panel)? thisObj: new window ("palette", "Estudio Voraz Panel', undefined, {resizable: true}");
res = "group {orientation:"column",-}".
groupOne: Panel {text: 'Master', direction: "column", alignment: ['fill ', ' fill'], alignChildren: ["fill", "fill"],------}
ddPanel: DropDownList {properties: {items: ['OFF', 'Salida No. Image', 'Salida No. Astérix', 'Salida Ventana Asterix','-']}}, \
},\
groupTwo: Panel {text:' template:', direction: "column", the alignment: ['fill', 'top'], alignChildren: ["fill", "fill"],------}
imageDemo: IconButton {text: 'Model Salida No. Image',}, alignment: ["fill", "fill"],
},\
groupThree: Panel {text: 'Color System + line selector', direction: "column", alignment: ['fill ', ' fill'], alignChildren: ["fill", "fill"],------}
ddColorSystem: DropDownList {properties: {items: ['Amarillo', 'Morado', 'Blue', 'MidBlue', 'DarkBlue','Roj o ']}}, \
ddLineSelector: DropDownList {properties: {elements: ['line 1' ", ' 1 Hashtag + line" ", ' 1 line + Info", 1 Line + Info + Hashtag ','-', "2 lines","2 lines + Hashtag" ", ' 2 lines + Info", 2 lines + Info + Hashtag ',' '-', ' 3 lines "", ' 3 lines + Hashtag "", ' 3 lines + Info ' ", ' 3 lines + Info + Hashtag"]}},
},\
BtnGroup: Panel {text: 'Botones' orientation: 'row', alignment: ['fill', 'top'],------}
editText: button {text: 'Edit text', alignment: preferredSize ['fill', 'left'],: [80,25]},
editCaritas: button {text: 'Edit Caritas', alignment: preferredSize ['fill', 'left'],: [80,25]},
editIconos: button {text: "Edit Iconos", alignment: preferredSize ['fill', 'left'],: [80,25]},
editImage: button {text: "Change image", alignment: ['fill', 'left'], preferredSize: [100,25]},
},\
groupFour: Panel {text:'Caritas / Iconos, direction: "column", alignment: ['fill ', ' fill'], alignChildren: ["fill", "fill"],------}
ddArreglosAsterix: DropDownList {properties: {items: ['OFF', "Caritas Astérix", 'Iconos Astérix']}}, \
},\
groupChecker: Panel {text: 'Options', orientation: 'row', alignment: alignChildren ['fill ', ' fill'],: ["fill", "fill"],------}
ddPatterns: DropDownList {properties: {items: ['Models OFF', '-', "Acción", "Comedia", "Deportees", "Girly", "Geek", "Todo",' -','EXTRA ','-',' ASTERIX ']}},
CBfoto: Case {text: "Foto"},
CBWipper: Case {text: 'Wipper In'}, \
CBSting: Case {text: 'Hashtag Sting'}, \
},\
groupRender: Panel {text: "Add al Render tail", orientation: 'row', alignment: ['fill ', ' fill'], alignChildren: ["fill", "fill"],------}
renBtn: button {text: 'Add al Render tail'}, \
},\
groupVoraz: Panel {text: "www.estudiovoraz.com", of orientation: 'column', alignment: ['fill ', ' fill'], alignChildren: ["fill", "fill"],------}
myIconButton: IconButton {text: 'IconButton',},
},\
}";
myPanel.grp = myPanel.add (res);
Default values (Practicamete're nada mas para indicate en position default por goes a permanecer cada cosa).
myPanel.grp.groupOne.ddPanel.selection = 0
myPanel.grp.groupFour.ddArreglosAsterix.selection = 0
myPanel.grp.groupThree.ddColorSystem.selection = 0
myPanel.grp.groupThree.ddLineSelector.selection = 0
myPanel.grp.groupChecker.ddPatterns.selection = 0
myPanel.grp.groupVoraz.myIconButton.image = imagePath0
myPanel.grp.groupTwo.imageDemo.image = imagePath1
myPanel.layout.layout (true);
Home default
myPanel.grp.groupTwo.visible = true;
myPanel.grp.groupThree.visible = false;
myPanel.grp.BtnGroup.visible = false;
myPanel.grp.groupFour.visible = false;
myPanel.grp.groupRender.visible = false;
myPanel.grp.groupChecker.visible = false;
myPanel.grp.groupTwo.imageDemo.image = imagePath1
AL HACER CLICK IN THE IMAGEN MANDA UNA ALERTED
myPanel.grp.groupTwo.imageDemo.onClick = function)
{
Alert ("Primero debes seleccionar una opcion del Menu drop-down. ADVERTENCIA esto solo con works the paquetería of channel 5. \
("If need more information you can consultarlo con www.estudiovoraz.com");
}
From aqui to add todo el código than dedicate con sus variable mandas is a call desde tus variable y functions.
Sub-panels: (Cuando mandas a con call variable in a number of a specific algo to you UI)
var BtnURL = myPanel.grp.groupVoraz.myIconButton
var BtnText = myPanel.grp.BtnGroup.editText
var BtnCaritas = myPanel.grp.BtnGroup.editCaritas
var BtnIconos = myPanel.grp.BtnGroup.editIconos
var BtnImagen = myPanel.grp.BtnGroup.editImage
var ddSelectPanel = myPanel.grp.groupOne.ddPanel
var myPanel.grp.groupThree.ddColorSystem = ddColor
var ddPatterns = myPanel.grp.groupChecker.ddPatterns
var ddLineSelector = myPanel.grp.groupThree.ddLineSelector
var ddOpciones = myPanel.grp.groupFour.ddArreglosAsterix
var rendaBtn = myPanel.grp.groupRender.renBtn
var myPanel.grp.groupChecker.CBfoto = CFoto
var CWipper = myPanel.grp.groupChecker.CBWipper
var CSting = myPanel.grp.groupChecker.CBSting
var patInp = myPanel.grp.groupFour.patInp
MANAGER PARA AS VEAN O SE ESCONDAN LAS THINGS LED PANEL
ddSelectPanel.onChange = function()
{
Switch (ddSelectPanel.Selection.Text)
{
//PRIMER CASE --------- SALIDA NO IMAGE ---------
case "Salida No. Image":
myPanel.grp.groupTwo.visible = true;
myPanel.grp.groupTwo.imageDemo.image = imagePath2
myPanel.grp.groupThree.visible = true;
myPanel.grp.BtnGroup.visible = true;
myPanel.grp.BtnGroup.editImage.visible = false;
myPanel.grp.groupFour.visible = true;
myPanel.grp.groupRender.visible = true;
myPanel.grp.groupChecker.visible = true;
myPanel.grp.BtnGroup.editCaritas.visible = true;
myPanel.grp.BtnGroup.editIconos.visible = true;
myPanel.grp.BtnGroup.editImage.visible = false;
myPanel.grp.groupChecker.CBSting.visible = false;
myPanel.grp.groupChecker.CBfoto.visible = false;
CUANDO SE EN EL MENU SELECT DROPDOWN SALIDA NO. IMAGE O LO THAT MATCH, LO ABRE EN EL VIEWER
projectItem ("_Render Salida No. Image") .openInViewer ();
CUANDO SE HACE CLICK IN IMAGE TREE MODEL USED
myPanel.grp.groupTwo.imageDemo.onClick = function)
{
projectItem ("_Render Salida No. Image") .openInViewer ();
}
ACCION BOX WIPPER
CWipper.onClick = function)
{
if(CWipper.Value == true)
{
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([1]);
}
if(CWipper.Value == False)
{
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([0]);
}
}
COLOR SYSTEM OF MENU DROP-DOWN
ddColor.onChange = function)
{
Switch (ddColor.selection.text)
{
case "Amarillo":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([1]);
break;
case 'Morado ':
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([2]);
break;
case "LightBlue":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([3]);
break;
case study 'MidBlue ':
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([4]);
break;
case "blue":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([5]);
break;
case "Rojo":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([6]);
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
LINE SELECTOR DROPDOWN LIST
ddLineSelector.onChange = function)
{
Switch (ddLineSelector.selection.text)
{
case "1-line":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([1]);
break;
case "1 line + Hashtag:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([2]);
break;
case "1 line + Info:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([3]);
break;
case "1 line + Info + Hashtag:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([4]);
break;
case "2 lines:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([6]);
break;
case "2 lines + Hashtag:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([7]);
break;
case "2 lines + Info:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([8]);
break;
case "2 lines + Info + Hashtag:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([9]);
break;
case "3 lines":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([11]);
break;
case '3 lines + Hashtag:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([12]);
break;
case '3 lines + Info:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([13]);
break;
case '3 lines + Info + Hashtag:
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([14]);
break;
by default:
Alert ("error: perhaps not a stereo none option, select una opcion del Line Selector");
break;
}
}
LIST DROPDOWN CARITAS / ICONOS
ddOpciones.onChange = function)
{
Switch (ddOpciones.selection.text)
{
case "OFF":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property (Caritas Asterix").setValue([0])";
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("Iconos Asterix").setValue([0]);
break;
case "Caritas Astérix":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property (Caritas Asterix").setValue([1])";
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("Iconos Asterix").setValue([0]);
break;
case "Iconos Astérix":
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property (Caritas Asterix").setValue([0])";
projectItem("Salida_No_Image").layer ("_Control") .property ("Effects").property("Control_v2").property ("Iconos Asterix").setValue([1]);
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
EDIT TEXT BUTTON
BtnText.onClick = function)
{
projectItem ("NIS _EditTxt") .openInViewer ();
}
CHANGE CARITAS BOTON
BtnCaritas.onClick = function)
{
projectItem ("NIS _EditCaritas") .openInViewer ();
}
CHANGE THE BOTON ICONOS
BtnIconos.onClick = function)
{
projectItem ("NIS _EditIconos") .openInViewer ();
}
MODELS OF MENU DROP-DOWN
ddPatterns.onChange = function)
{
Switch (ddPatterns.selection.text)
{
case 'OFF models':
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([1]) of control. "
break;
case "acción":
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([3]) of control. "
break;
case "Comedia":
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([4]) of control. "
break;
case "deportees":
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([5]) of control. "
break;
case "Girly":
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([6]) of control. "
break;
case 'Geek ':
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([7]) of control. "
break;
case "Todo":
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([8]) of control. "
break;
case 'EXTRA ':
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([10]) of control. "
break;
case "ASTERIX":
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([12]) of control. "
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
ACCION BOX FOTO
CFoto.onClick = function)
{
if(CFoto.Value == true)
{
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Foto").setValue([1]) of control. "
}
if(CFoto.Value == False)
{
"projectItem("Salida_No_Image").layer ("_Control").property("Effects").property (v2").property("Foto").setValue([0]) of control. "
}
}
ADD TO RENDER QUEUE
rendaBtn.onClick = function)
{
var QTtemplate = "Lossless." Select el model
salt1 var = projectItem ("_Render Salida No. Image"); Search the model that will has Renderizar por su number
var newPath = ('Salida No. Image'); Este are el number del path knew the asigna para salida to
If (salt1! = null & & salt1 instanceof CompItem) {}
var theRender = app.project.renderQueue.items.add (salt1);
If (salt1 == salt1) {}
theRender.outputModules [1] .applyTemplate (QTtemplate);
theRender.outputModules [1] mpfprojectdir\dev10\src\csharp\projectbase.file = new queue (newPath);
}
}
}
break;
//SEGUNDO CASE --------- SALIDA NO ASTERIX ---------
case "Salida No. Asterix":
myPanel.grp.groupTwo.visible = true;
myPanel.grp.BtnGroup.editImage.visible = true;
myPanel.grp.groupTwo.imageDemo.image = imagePath3
myPanel.grp.groupThree.visible = true;
myPanel.grp.BtnGroup.visible = true;
myPanel.grp.groupFour.visible = true;
myPanel.grp.groupRender.visible = true;
myPanel.grp.groupChecker.visible = true;
myPanel.grp.groupChecker.CBSting.visible = false;
myPanel.grp.groupChecker.CBfoto.visible = false;
myPanel.grp.groupFour.visible = false;
myPanel.grp.BtnGroup.editCaritas.visible = false;
myPanel.grp.BtnGroup.editIconos.visible = false;
myPanel.grp.BtnGroup.editImage.visible = false;
CUANDO SE EN EL MENU SELECT DROPDOWN SALIDA NO. IMAGE O LO THAT MATCH, LO ABRE EN EL VIEWER
projectItem ("_Render Salida No. Asterix") .openInViewer ();
CUANDO SE HACE CLICK IN IMAGE TREE MODEL USED
myPanel.grp.groupTwo.imageDemo.onClick = function)
{
projectItem ("_Render Salida No. Asterix") .openInViewer ();
}
ACCION BOX WIPPER
CWipper.onClick = function)
{
if(CWipper.Value == true)
{
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([1]);
}
if(CWipper.Value == False)
{
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([0]);
}
}
COLOR SYSTEM OF MENU DROP-DOWN
ddColor.onChange = function)
{
Switch (ddColor.selection.text)
{
case "Amarillo":
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([1]);
break;
case 'Morado ':
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([2]);
break;
case "LightBlue":
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([3]);
break;
case study 'MidBlue ':
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([4]);
break;
case "blue":
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([5]);
break;
case "Rojo":
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([6]);
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
LINE SELECTOR DROPDOWN LIST
ddLineSelector.onChange = function)
{
Switch (ddLineSelector.selection.text)
{
case "1-line":
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([1]);
break;
case "1 line + Hashtag:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([2]);
break;
case "1 line + Info:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([3]);
break;
case "1 line + Info + Hashtag:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([4]);
break;
case "2 lines:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([6]);
break;
case "2 lines + Hashtag:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([7]);
break;
case "2 lines + Info:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([8]);
break;
case "2 lines + Info + Hashtag:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([9]);
break;
case "3 lines":
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([11]);
break;
case '3 lines + Hashtag:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([12]);
break;
case '3 lines + Info:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([13]);
break;
case '3 lines + Info + Hashtag:
projectItem("Salida_No_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([14]);
break;
by default:
Alert ("error: perhaps not a stereo none option, select una opcion del Line Selector");
break;
}
}
MODELS OF MENU DROP-DOWN
ddPatterns.onChange = function)
{
Switch (ddPatterns.selection.text)
{
case 'OFF models':
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([1]) of control. "
break;
case "acción":
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([3]) of control. "
break;
case "Comedia":
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([4]) of control. "
break;
case "deportees":
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([5]) of control. "
break;
case "Girly":
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([6]) of control. "
break;
case 'Geek ':
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([7]) of control. "
break;
case "Todo":
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([8]) of control. "
break;
case 'EXTRA ':
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([10]) of control. "
break;
case "ASTERIX":
"projectItem("Salida_No_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([12]) of control. "
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
EDIT TEXT BUTTON
BtnText.onClick = function)
{
projectItem ("_EditTxt SNA") .openInViewer ();
}
ADD TO RENDER QUEUE
rendaBtn.onClick = function)
{
var QTtemplate = "Lossless." Select el model
var SEL2 = projectItem ("_Render Salida Asterix No."); Search the model that will has Renderizar por su number
var newPath = ('Salida No. Asterix'); Este are el number del path knew the asigna para salida to
If (sel2! = null & & sel2 instanceof CompItem) {}
var theRender = app.project.renderQueue.items.add (sel2);
If (sel2 == sel2) {}
theRender.outputModules [1] .applyTemplate (QTtemplate);
theRender.outputModules [1] mpfprojectdir\dev10\src\csharp\projectbase.file = new queue (newPath);
}
}
}
break;
//TERCER CASE --------- SALIDA VENTANA ASTERIX ---------
case "Salida Ventana Astérix":
myPanel.grp.groupTwo.visible = true;
myPanel.grp.groupTwo.imageDemo.image = imagePath5
myPanel.grp.groupThree.visible = true;
myPanel.grp.BtnGroup.visible = true;
myPanel.grp.BtnGroup.editImage.visible = true;
myPanel.grp.groupFour.visible = false;
myPanel.grp.groupRender.visible = true;
myPanel.grp.groupChecker.visible = true;
myPanel.grp.BtnGroup.editCaritas.visible = false;
myPanel.grp.BtnGroup.editIconos.visible = false;
myPanel.grp.BtnGroup.editImage.visible = true;
myPanel.grp.groupChecker.CBSting.visible = false;
myPanel.grp.groupChecker.CBfoto.visible = true;
CUANDO SE EN EL MENU SELECT DROPDOWN SALIDA NO. IMAGE O LO THAT MATCH, LO ABRE EN EL VIEWER
projectItem ("_Render Salida Ventana Asterix") .openInViewer ();
CUANDO SE HACE CLICK IN IMAGE TREE MODEL USED
myPanel.grp.groupTwo.imageDemo.onClick = function)
{
projectItem ("_Render Salida Ventana Asterix") .openInViewer ();
}
ACCION BOX WIPPER
CWipper.onClick = function)
{
if(CWipper.Value == true)
{
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([1]);
}
if(CWipper.Value == False)
{
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([0]);
}
}
COLOR SYSTEM OF MENU DROP-DOWN
ddColor.onChange = function)
{
Switch (ddColor.selection.text)
{
case "Amarillo":
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([1]);
break;
case 'Morado ':
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([2]);
break;
case "LightBlue":
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([3]);
break;
case study 'MidBlue ':
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([4]);
break;
case "blue":
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([5]);
break;
case "Rojo":
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("colour System").setValue([6]);
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
LINE SELECTOR DROPDOWN LIST
ddLineSelector.onChange = function)
{
Switch (ddLineSelector.selection.text)
{
case "1-line":
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([1]);
break;
case "1 line + Hashtag:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([2]);
break;
case "1 line + Info:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([3]);
break;
case "1 line + Info + Hashtag:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([4]);
break;
case "2 lines:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([6]);
break;
case "2 lines + Hashtag:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([7]);
break;
case "2 lines + Info:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([8]);
break;
case "2 lines + Info + Hashtag:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([9]);
break;
case "3 lines":
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([11]);
break;
case '3 lines + Hashtag:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([12]);
break;
case '3 lines + Info:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([13]);
break;
case '3 lines + Info + Hashtag:
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("line Selector").setValue([14]);
break;
by default:
Alert ("error: perhaps not a stereo none option, select una opcion del Line Selector");
break;
}
}
EDIT TEXT BUTTON
BtnText.onClick = function)
{
projectItem ("SVA _EditTxt") .openInViewer ();
}
BtnImagen.onClick = function)
{
projectItem ("SVA _EditFootage") .openInViewer ();
}
MODELS OF MENU DROP-DOWN
ddPatterns.onChange = function)
{
Switch (ddPatterns.selection.text)
{
case 'OFF models':
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([1]) of control. "
break;
case "acción":
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([3]) of control. "
break;
case "Comedia":
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([4]) of control. "
break;
case "deportees":
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([5]) of control. "
break;
case "Girly":
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([6]) of control. "
break;
case 'Geek ':
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([7]) of control. "
break;
case "Todo":
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([8]) of control. "
break;
case 'EXTRA ':
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([10]) of control. "
break;
case "ASTERIX":
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Patterns").setValue([12]) of control. "
break;
by default:
Alert ("error: perhaps no none option selected, brought Nuevo...");
break;
}
}
ACCION BOX FOTO
CFoto.onClick = function)
{
if(CFoto.Value == true)
{
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Foto").setValue([1]) of control. "
}
if(CFoto.Value == False)
{
"projectItem("Salida_Ventana_Asterix").layer ("_Control").property("Effects").property (v2").property("Foto").setValue([0]) of control. "
}
}
ACCION BOX FOTO
CWipper.onClick = function)
{
if(CWipper.Value == true)
{
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([1]);
}
if(CWipper.Value == False)
{
projectItem("Salida_Ventana_Asterix").layer ("_Control") .property ("Effects").property("Control_v2").property ("Wipper In").setValue([0]);
}
}
ADD TO RENDER QUEUE
rendaBtn.onClick = function)
{
var QTtemplate = "Lossless." Select el model
salt1 var = projectItem ("_Render Salida Ventana Asterix"); Search the model that will has Renderizar por su number
var newPath = ('Salida Ventana Asterix'); Este are el number del path knew the asigna para salida to
If (salt1! = null & & salt1 instanceof CompItem) {}
var theRender = app.project.renderQueue.items.add (salt1);
If (salt1 == salt1) {}
theRender.outputModules [1] .applyTemplate (QTtemplate);
theRender.outputModules [1] mpfprojectdir\dev10\src\csharp\projectbase.file = new queue (newPath);
}
}
}
break;
//DEFAULT CASE --------- DEFAULT CASE APAGA TODO ---------
by default:
myPanel.grp.groupTwo.visible = true;
myPanel.grp.groupThree.visible = false;
myPanel.grp.BtnGroup.visible = false;
myPanel.grp.groupFour.visible = false;
myPanel.grp.groupRender.visible = false;
myPanel.grp.groupChecker.visible = false;
myPanel.grp.groupTwo.imageDemo.image = imagePath1
AL HACER CLICK IN THE IMAGEN MANDA UNA ALERTED
myPanel.grp.groupTwo.imageDemo.onClick = function)
{
Alert ("Primero debes seleccionar una opcion del Menu drop-down. ADVERTENCIA esto solo con works the paquetería of channel 5. \
("If need more information you can consultarlo con www.estudiovoraz.com");
}
break;
}
}
ACCIÓN PARA EL ESTUDIO VORAZ LINK
BtnURL.onClick = LinkToURL;
function LinkToURL()
{
alert ("http://www.estudiovoraz.com");
var URL = " http://www.estudiovoraz.com "; your web page
If ($.os.indexOf ("Windows")! = - 1).
system.callSystem (winBrowserCmd + "" + URL);
on the other
system.callSystem (macBrowserCmdStart + URL + macBrowserCmdEnd);
}
FUNCION WHAT TODOS LOS OF THE INDEX OF THE ITEM PROJECT DETECTA Y IN ASIGNARLE LUGAR DEL LO DETECTA POR SU NUMBER NUMBER
projectItem (name) function
{
var items = app.project.items;
i = 1;
While (I < = items.length) {}
If (items [i] .name = name)
{
Return app.project.item (i);
break;
}
i ++ ;
}
}
END PANEL - NO PONER NADA ESTA LINEA ABAJO.
Return myPanel;
}
var myScriptPal = myScript_buildUI (thisObj);
If ((myScriptPal! = null) & & (myScriptPal instanceof window)) {}
myScriptPal.center ();
myScriptPal.show ();
}
}
myScript (this);
}
OK, apparently it does work well with panels, because even if the height is 0, something is from the Panel...
You can try the panels inside the packing groups. It will start to be a little heavy, but it works.
Here's a toy example to illustrate:
var w = new Window("palette", "test"); w.content=w.add("group{orientation: 'column', margins: 0, spacing: 0,\ alignment: ['fill', 'fill'], alignChildren: ['fill', 'top'],\ gr1: Group{orientation: 'row', margins: [0,5,0,5], spacing: 10, alignChildren: ['fill', 'center'],\ titleST: StaticText{text: 'Option Level', alignment: ['left', 'center']},\ menu : DropDownList{properties: {items: ['0', '1', '2', '3']}},\ },\ gr2: Group{orientation: 'row', margins: [0,5,0,5], alignChildren: ['fill', 'center'],\ content: Panel{orientation: 'row', margins: [5, 10, 5, 5], spacing: 0, alignChildren: ['fill', 'center'],\ text : 'Option 1',\ menu : DropDownList{properties: {items: ['A', 'B', 'C', 'D', 'E']}},\ },\ },\ gr3: Group{orientation: 'row', margins: [0,5,0,5], alignChildren: ['fill', 'center'],\ content: Panel{orientation: 'row', margins: [5, 10, 5, 5], spacing: 0, alignChildren: ['fill', 'center'],\ text : 'Option 2',\ menu : DropDownList{properties: {items: ['A', 'B', 'C', 'D', 'E']}},\ },\ },\ gr4: Group{orientation: 'row', margins: [0,5,0,5], alignChildren: ['fill', 'center'],\ content: Panel{orientation: 'row', margins: [5, 10, 5, 5], spacing: 0, alignChildren: ['fill', 'center'],\ text : 'Option 3',\ menu : DropDownList{properties: {items: ['A', 'B', 'C', 'D', 'E']}},\ },\ },\ gr5: Panel{orientation: 'row', margins: [5, 10, 5, 5], spacing: 10, alignChildren: ['fill', 'center'],\ text : 'Commands',\ btnA: Button{text: 'A'}, btnB: Button{text: 'B'}, btnC: Button{text: 'C'},\ },\ }"); w.content.gr1.menu.onChange = function(){ // set visibility of options groups (gr2 to gr4) var x = this.selection.index + 1; var k; for (k=1; k<=3; k++){ w.content.children[k].maximumSize.height = x>k ? 1000 : 0; }; w.layout.layout(true); }; //============================== w.content.gr1.menu.selection = 0; w.show();
Xavier
-
How to trigger a refresh of a drop-down list when the selection is changed
Hello
This is a general question of ExtendScript, but since I work with FM, I'll ask here first. I have a bit of a paradox here and I'm not sure of the best way to manage it.
I have a dialog box with a drop-down list, where I want to refresh some controls when the user changes the selection in the list (dropdownList.onChange). This includes them refresh the content of the list itself. However, the problem is, whenever I try to update the content of the list, onChange triggers again. So, if I put the call to update box in the onChange handler, it will result an infinite loop, because my upgrade function fires onChange when it refreshes the list.
Does anyone know a better methodology, where I can safely triggers a refresh of a drop-down list in the list's onChange event handler? I really wish that onChange was reserved for an action of the user only, or at least there is a property for this purpose.
Russ
Hi Fabio,.
You can't "Refresh" a menu drop-down.
But you can rebuild.
You must do it "manually".
As I do:
1. I have a picture I want to show in the dropdownlist control.
2. I have delete all children: myList.removeAll ();
3 I have rebuild the list via mylist.add ("item", "myArray [index] in a for - loop.
But if you know the exact position of the elements to remove or add, you can do so via splice()
-
Value of DropDownList selected by default?
Hello
I've got following DropDownList, but he gets made without any options selected. "How can I make" a "the default option for this item?
var w, layout; layout = "dialog { \ dropdown: DropDownList { \ size: [100,20] \ properties: { \ items: ['one','two','three'] \ } \ } \ }"; w = new Window(layout); w.show();
Thank you
There are various ways here is a way to show the value when it is changed.
var w, layout; layout = "dialog { \ dropdown: DropDownList { \ size: [100,20] \ properties: { \ items: ['one','two','three'] \ } \ } \ }"; w = new Window(layout); w.dropdown.selection=0; w.dropdown.onChange= function(){ alert(w.dropdown.selection.text); } w.show();
-
Change the content of the drop-down list
Hello
Is it possible to change the content of a drop-down list after its done?
I have a dialog box, and based on user input, the drop-down list should change
I saw the opportunity to add to a drop-down list, but I did see the possibility of changing the entire list
Is this possible?
Thank you
Davey
#targetengine test var w = new Window ('palette'), d1 = w.add('dropdownlist', undefined, [1,2,3,4,5]), b1 = w.add('button', undefined, "Slow Refresh"), b2 = w.add('button', undefined, "Fast Refresh"), myNewItems = [6,7,8,9,10]; b2.onClick = function () {refreshList (myNewItems)}; b2.onClick = function () {refreshList2 (myNewItems)}; d1.onChange = function () {alert(d1.selection)}; function refreshList (newItems) { var l = d1.items.length, c; while (l--) d1.remove(d1.children[l]); l = newItems.length, c; for (c = 0; c < l; c++) d1.add('item', newItems[c]); } function refreshList2 (newItems) { tempDropdownlist = w.add('dropdownlist', d1.bounds, newItems); tempDropdownlist.onChange = d1.onChange; // etc. w.remove (d1); d1 = tempDropdownlist; } w.show();
Trevor
-
How to change the "TextVariable" via javascript
Hello
How can I change the value of a "Custom text Variable" via javascript in indesign CS5?
I understand that there is a 'content' that is me allotted property, but I can't understand how to set or change.
Here's the javascript code example for reference.
var docRef = app.activeDocument; for ( var i = 0; i < docRef.textVariables.length; i++ ) { var textVariableItem = docRef.textVariables[i]; // Check for the type if (textVariableItem.variableType === VariableTypes.CUSTOM_TEXT_TYPE){ var variableOption = textVariableItem.variableOptions; // This will give me the text value of the variable alert("Text Variable " + i + " \n " + textVariableItem.name + "\n" + variableOption.contents); // But how do I set it? // The following does not seem to work variableOption.contents = "New custom text..."; } }
// Logic behind this script // theScript() // is a wrapper function to provide functional scope to the entire script // This function is invoked at the very bottom of the file // main(); // the main function that gathers the initial parameters and launches the dialog box // function mainDialog(docRef, selectedItems, layers, inputs) // A function that creates a dialog box this function is passed as a parameter to a "factory method" // called function sfDialogFactory(dialog) // which is a general purpose utility for creating dialog boxes. // The mainDialog function has a callback function that responds to the "comtinue" button and after some validation // makes a call to a function called // function doAction(docRef, inputs, options) // This is where the main behvior of the script is suppose to be defined. // it is designed to be called AFTER the dialog box return and is the result of the callback inside mainDialog // The doAction function receives objects that are parameter holders for various inputs and options that come from the // dialog box presented to the user function theScript() { /////////////////////////////////////////////////// // BEGIN THE SCRIPT //================================================= //////////////////////////////////////////////////////////////////////////////// // SCRIPT MAIN PROCESS //////////////////////////////////////////////////////////////////////////////// // Main Process // The beginning of the script starts here // Add main logic routine to this function // Call Main Function to get the ball rolling var elementsData; var theDocument = app.activeDocument; var inputGroup; main(); function main(){ var theSelectedItems = theDocument.selection; var theLayers = theDocument.layers; var myDialog = sfDialogFactory(mainDialog(theDocument, theSelectedItems), theLayers); var result = myDialog.show(); if (result == 1){ newAction(); alert("Done"); } else{ alert("Not Done"); } } //////////////////////////////////////////////////////////////////////////////// // SCRIPT SUPPORTING FUNCTIONS //////////////////////////////////////////////////////////////////////////////// // Supporting Functions // Include functions that offer partial functionality // These functions are called and acted upon within the mainProcess function function newAction(){ var formData = getControlValues(inputGroup); var inputs = {}; var options = {}; // alert("callback get form data"); // Do something with formData values here var cLen = formData.controls.length; var formValues = ''; for (var c = 0; c < cLen; c++ ) { if (formData.controls[c].name === "inputECONumber") { inputs.inputECONumber = formData.controls[c].value; // alert(formData.controls[c].name + " | " + formData.controls[c].value); } if (formData.controls[c].name === "inputDocumentName") { inputs.inputDocumentName = formData.controls[c].value; // alert(formData.controls[c].name + " | " + formData.controls[c].value); } if (formData.controls[c].name === "inputDocumentNumber") { inputs.inputDocumentNumber = formData.controls[c].value; // alert(formData.controls[c].name + " | " + formData.controls[c].value); } if (formData.controls[c].name === "inputDocumentRevision") { inputs.inputDocumentRevision = formData.controls[c].value; // alert(formData.controls[c].name + " | " + formData.controls[c].value); } if (formData.controls[c].name === "inputDocumentType") { inputs.inputDocumentType = formData.controls[c].value; // alert(formData.controls[c].name + " | " + formData.controls[c].value); } }//End FOR doAction(theDocument, inputs, options); } function mainDialog(docRef, selectedItems, layers, inputs) { // Main Dialog // alert("Main Dialog: " + docRef.name); if ( docRef === undefined ) { alert("Cannot Execute, please select a document."); } var currentData = getMetaData(); var dialogObj = {}; dialogObj.groups = []; // An array of dialog groups dialogObj.title = "Update Meta Data"; var groupLabelInfo = {}; groupLabelInfo.title = "Edit: " + docRef.name; // Add Elements using JSON shorthand syntax groupLabelInfo.elements = [ { "name":"labelECONumber", "type":"statictext", "value":"Engineering Change Order (ECO) Number", "visible":true }, { "name":"inputECONumber", "type":"edittext", "value": currentData.inputECONumber, "visible":true }, { "name":"documentName", "type":"statictext", "value":"Document Name", "visible":true }, { "name":"inputDocumentName", "type":"edittext", "value": currentData.inputDocumentName, "visible":true }, { "name":"documentNumber", "type":"statictext", "value":"Document Number", "visible":true }, { "name":"inputDocumentNumber", "type":"edittext", "value": currentData.inputDocumentNumber, "visible":true }, { "name":"documentRevision", "type":"statictext", "value":"Revision", "visible":true }, { "name":"inputDocumentRevision", "type":"dropdownlist", "value": currentData.listRevisions, "visible":true, "selection":currentData.selectionRevision, }, { "name":"documentType", "type":"statictext", "value":"Label Type", "visible":true }, { "name":"inputDocumentType", "type":"dropdownlist", "value": currentData.listDocumentTypes, "visible":true, "selection":currentData.selectionDocumentType, }, ]; // Add to groups to list dialogObj.groups.push(groupLabelInfo); return dialogObj; } function doAction(docRef, inputs, options) { alert("doAction " + docRef.name + " \n INPUTS: \n" + inputs.reflect.properties + "\n\n OPTIONS: \n" + options.reflect.properties); // Get the current contents var fooContents = app.activeDocument.textVariables.item ('Foo').variableOptions.contents; var barContents = app.activeDocument.textVariables.item ('Bar').variableOptions.contents; alert("GET textVariable contents \n Foo: \n" + fooContents + "\n\n Bar: \n" + barContents); // Set/Update the contents // Why does this not seem to work? alert("SET textVariable contents \n Foo: \n" + inputs.inputDocumentName + "\n\n Bar: \n" + inputs.inputDocumentType); app.activeDocument.textVariables.item ('Foo').variableOptions.contents = inputs.inputDocumentName; app.activeDocument.textVariables.item ('Bar').variableOptions.contents = inputs.inputDocumentType; // Script does not seem to reach this point. Why? alert("END of doAction"); } // A Factory function for creating dialog boxes function sfDialogFactory(dialog) { // A factory method for creating dialog screens // Dialog Window var d = new Window("dialog", dialog.title); // alert("Number of Inputs" + dialog.inputs.length); // alert("Number of Options" + dialog.options.length); var i; // counter var len; // length of array elements // Generate Groups if (dialog.groups.length > 0) { len = dialog.groups.length; for (i = 0; i < len; i++ ) { var currentGroup = dialog.groups[i]; inputGroup = d.add ("panel", undefined, currentGroup.title); inputGroup.alignChildren = ["fill","fill"]; if (currentGroup.elements.length > 0) { // Add Elements var ii; var elemLen = currentGroup.elements.length; for (ii = 0; ii < elemLen; ii++ ) { var currentElement = currentGroup.elements[ii]; var el = inputGroup.add(currentElement.type, undefined, currentElement.value); // Additional properties added for future reflection el.elName = currentElement.name; el.elIndex = ii; switch(currentElement.type) { case "statictext": el.visible = currentElement.visible; break; case "edittext": el.visible = currentElement.visible; break; case "dropdownlist": el.visible = currentElement.visible; el.selection = currentElement.selection; el.onChange = currentElement.onChange; break; case "checkbox": el.visible = currentElement.visible; el.value = currentElement.value; break; default: throw new Error('Unknown Dialog Element Type [' + currentElement.type + ']'); } } } } } // Buttons Group var buttonGroup = d.add("group"); var bOK = buttonGroup.add("button", undefined, "Continue", {name: "ok"}); var bCANCEL = buttonGroup.add("button", undefined, "Cancel", {name: "cancel"}); return d; } function getControlValues(set) { elementsData = {}; elementsData.controls = []; // TO DO Add more types var giLen = set.children.length; for (var gi = 0; gi < giLen; gi++ ) { var child = set.children[gi]; // alert(objReflection(child, "none", false)); // alert(child.type); var control = {}; control.name = child.elName; control.index = child.elIndex; control.type = child.type; control.visible = child.visible; switch(child.type) { case "statictext": control.value = child.text; break; case "edittext": control.value = child.text; break; case "dropdownlist": control.value = child.selection.text; break; case "checkbox": control.value = child.value; break; default: throw new Error('Unknown Dialog Element Type'); } elementsData.controls.push(control); // alert(objReflection(control, "none", false)); } return elementsData; } function getMetaData() { // Return a data structure that contains meta data from the document. var dataObject = {}; // Default arrays dataObject.listRevisions = generateRangeOfNumbers ("r", 1, 100); dataObject.listDesignComps = generateRangeOfNumbers ("Comp_", 1, 100); dataObject.listDocumentTypes = [ "Datasheet", "Manual", "Tech Guide", "Other" ]; // Set Sensible Default Values for the UI Form if (!dataObject.inputECONumber) { dataObject.inputECONumber = "###ECO###"; } if (!dataObject.inputDocumentName) { dataObject.inputDocumentName = "Document Name"; } if (!dataObject.inputDocumentNumber) { dataObject.inputDocumentNumber = "048-xxx-30"; } if (!dataObject.inputDocumentRevision) { dataObject.inputDocumentRevision = "r01"; } if (!dataObject.inputDocumentType) { dataObject.inputDocumentType = "Datasheet"; } return dataObject; } function generateRangeOfNumbers (prefix, start, end) { // This function generates an array of sequential numbers within a range // prefix = string to append to beginning of each element // start = the beginning of the range // end = the end of the range // length = overall number of cycles to loop through, start and end must fall within this value var output = []; for ( var i = start; i <= end; i++ ) { if (i < 10) { // Add a leading zero output.push(prefix + "0" + i); } else { output.push(prefix + i); } } return output; } //================================================= // END THE SCRIPT /////////////////////////////////////////////////// } theScript();
I modified your code shortly. He works for me here. Check it out...
Thank you
Green4ever
-
DropDownList - how to get the selected value
I have the next dropdownlist control:
Select.dd = Select.gMain.add('dropdownlist',undefined,FinalElements); Select.dd.onChange = notifyMe();
and the notifyMe() function
function notifyMe() { alert(this.selection); }
I need to use the value of the selected item in the menu dropdown. So for now I'm just an alert. However, nothing happens, when I change the selection in the drop-down list. How can I fix?
Hey!
Change this:
Select.dd.onChange = notifyMe();
to do this:
Select.dd.onChange = notifyMe;
--
tomaxxi
Maybe you are looking for
-
I need to change my security issues and said we do not have enough information to reset your
I need to change my security but said Questions we have insufficient information to reset security of your apple ID questions.my is [email protected] I want to slove this problem please help me
-
Satellite C650 - FN keys menu disappeared
I have a toshiba satellite C650 and usually when I press the Fn key, I get a menu with all the features at the top of the screen, recently the menu disappeared, the work of combinations of keys Fn, such as Fn + F1 to lock, but others, like disable th
-
HP photosmart 5224. Cannot change the size of the image
Send photos of the iPhone to the printer using photo Carpenter about no matter which presentation I use weather 1 picture or layout photo 4. The pictures come out both sides of the print only in the middle of page 1/3 of white sheet. I have printer c
-
USB-6501 open collector signal generation
Hi all I have carefully read the manual for this product, and I think that's what I'm looking for, but I was hoping just to get confirmation from someone who knows a bit more about it as I do. I have a stepper motor command that accepts control impu
-
programmatically launch a file with the default windows application
I thought it would be a trivial task, but I can't seem to be able to find something about it. I would like to be able to open any file in the native application - as if the user has double-clicked on it. Any suggestions?