Skip to content

Instantly share code, notes, and snippets.

@indiscripts
Created August 16, 2022 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indiscripts/75ec312a4f2df6ab299298020049a6b8 to your computer and use it in GitHub Desktop.
Save indiscripts/75ec312a4f2df6ab299298020049a6b8 to your computer and use it in GitHub Desktop.
Testing ScriptUI 'Secret Key' in Listbox (CC)
// Hiding secret keys in listbox
// (ScriptUI CC Only.)
// ---
var dlg = new Window('dialog');
var lst = dlg.add('group').add('listbox',void 0,
[
'item1' + '\0secretKey1',
'item2' + '\0secretKey2',
'item3' + '\0secretKey3',
'item4' + '\0secretKey4',
]);
lst.minimumSize = [150,150];
lst.onChange = function onListChange( sel)
{
sel = this.selection;
if( sel && (sel=sel.text) )
{
p = sel.indexOf('\0');
alert([
"Item: " + sel.slice(0,p),
"Secret Key: " + sel.slice(1+p)
].join('\r'));
}
}
dlg.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment