Quantcast
Channel: Adobe Community : Discussion List - Illustrator Scripting
Viewing all articles
Browse latest Browse all 3671

ScriptUI use space bar instead of return button

$
0
0

Is there anyway to have the space bar act as the return button for a ScriptUI dialog window?  Similar to how the {name: "ok"} works.  Right now the space bar will activate whichever button is highlighted, but ideally I'm trying to get it so that the space bar will always hit 'Yes', regardless of what is highlighted.

 

function temp() {    var dlg = new Window('dialog');    dlg.orientation = 'column';       var myPnl = dlg.add('panel');    myPnl.orientation = 'row';       var one = myPnl.add('radiobutton', undefined, 'IHP East (&1)' );    one.value = true;    one.shortcutKey = '1';    var two = myPnl.add('radiobutton', undefined, 'IHP West (&2)' );    two.shortcutKey = '2';    var three = myPnl.add('radiobutton', undefined, 'Three (&3)' );    three.shortcutKey = '3';       var btnPnl = dlg.add('panel');    btnPnl.orientation = 'row';       var yes = btnPnl.add('button', undefined, 'Yes', {name: "ok"} );    var no = btnPnl.add('button', undefined, 'No' );    var can = btnPnl.add('button', undefined, 'Cancel' );    dlg.defaultElement = yes;       yes.onClick = function() {        dlg.close();        $.write( "Yes\n" );    }       no.onClick = function() {        dlg.close();        $.write( "No\n" );    }       can.onClick = function() {        dlg.close();        $.write( "Cancel\n" );    }       dlg.show();
}

temp();

 

Thanks!


Viewing all articles
Browse latest Browse all 3671

Trending Articles