Copy link to clipboard
Copied
would you please help me in this regards
in nav bar have a button when click the button open a dialog box. threr have a three buttons.
when click any one i need to catch that event and close the parent dialog box.
// Set up the navigation bar
function buildNavbar(doc)
{
// retrieve the predefined NavBar object
// the type defaults to "scriptui"
var bottombar = doc.navbars.filesystem.bottom;
// display it
bottombar.visible = true;
// set the height
bottombar.height = 50;
// add a ScriptUI display frame
bottombar.pathPanel = bottombar.add( "panel", [5,5, 480,35], undefined); // bounds = [left, top, right, bottom]
// add UI components to the frame
bottombar.pathPanel.browseField = bottombar.pathPanel.add( "statictext",[3, 3, 395, 22],"");
bottombar.pathPanel.browseBtn = bottombar.pathPanel.add( "button",[400, 3, 465, 22],"Log In");
bottombar.pathPanel.browseField.text = doc.thumbnail.path;
// add the button's event handler, which navigates to the log in form
bottombar.pathPanel.browseBtn.onClick = function()
{
res = "dialog { \
info: Panel { orientation: 'column', alignChildren:'right', \
text: 'Log In Info', \
name: Group { orientation: 'row', \
s: StaticText { text:'User ID:' }, \
e: EditText { characters: 30 } \
}, \
addr: Group { orientation: 'row', \
s: StaticText { text:'Password:' }, \
e: EditText { characters: 30, properties:{noecho:true}} \
} \
}, \
buttons: Group { orientation: 'row', \
testBtn: Button { text:'Test' }, \
okBtn: Button { text:'OK', properties:{name:'ok'} }, \
cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \
} \
}";
win = new Window (res);
win.center();
win.show();
//$.writeln( win.info.name.e.text);
$.writeln( win.buttons.okBtn.text);
$.writeln( win.buttons.okBtn.properties.name.text);
// add the button's event handler, which navigates to the log in form
win.buttons.testBtn.onClick = function()
{
alert('here');
}
win.buttons.okBtn.onClick = function()
{
alert('here2');
}
}
}
win.show(); should be after the onClick events....
...// Set up the navigation bar
function buildNavbar(doc){
// retrieve the predefined NavBar object
// the type defaults to "scriptui"
var bottombar = doc.navbars.filesystem.bottom;
// display it
bottombar.visible = true;
// set the height
bottombar.height = 50;
// add a ScriptUI display frame
bottombar.pathPanel = bottombar.add( "panel", [5,5, 480,35], undefined); // bounds = [l
Copy link to clipboard
Copied
win.show(); should be after the onClick events....
// Set up the navigation bar
function buildNavbar(doc){
// retrieve the predefined NavBar object
// the type defaults to "scriptui"
var bottombar = doc.navbars.filesystem.bottom;
// display it
bottombar.visible = true;
// set the height
bottombar.height = 50;
// add a ScriptUI display frame
bottombar.pathPanel = bottombar.add( "panel", [5,5, 480,35], undefined); // bounds = [left, top, right, bottom]
// add UI components to the frame
bottombar.pathPanel.browseField = bottombar.pathPanel.add( "statictext",[3, 3, 395, 22],"");
bottombar.pathPanel.browseBtn = bottombar.pathPanel.add( "button",[400, 3, 465, 22],"Log In");
bottombar.pathPanel.browseField.text = doc.thumbnail.path;
// add the button's event handler, which navigates to the log in form
bottombar.pathPanel.browseBtn.onClick = function(){
res = "dialog { \
info: Panel { orientation: 'column', alignChildren:'right', \
text: 'Log In Info', \
name: Group { orientation: 'row', \
s: StaticText { text:'User ID:' }, \
e: EditText { characters: 30 } \
}, \
addr: Group { orientation: 'row', \
s: StaticText { text:'Password:' }, \
e: EditText { characters: 30, properties:{noecho:true}} \
} \
}, \
buttons: Group { orientation: 'row', \
testBtn: Button { text:'Test' }, \
okBtn: Button { text:'OK', properties:{name:'ok'} }, \
cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \
} \
}";
win = new Window (res);
//$.writeln( win.info.name.e.text);
$.writeln( win.buttons.okBtn.text);
$.writeln( win.buttons.okBtn.properties.name.text);
// add the button's event handler, which navigates to the log in form
win.buttons.testBtn.onClick = function(){
alert('here');
}
win.buttons.okBtn.onClick = function(){
win.close(0);
alert('here2');
}
win.center();
win.show();
}
};buildNavbar(app.documents[0]);
Copy link to clipboard
Copied
thank you very much