I'm not sure if you added this new control as a request related to this, but many thanks! This seems like the way to go.
I noticed that in 13.14.1, the script throws an error when using a dialog with this control:
- If is set to something different than 'Folders', and then you try to add items to it using Control.AddItem() or Control.value.
- If you try to access any of the
msg properties generated when interacting with the control (msg.event, msg.name, etc).
By the way, is there a way to make it read-only? That is, disable or hide the 'Add' button.
Thanks.

function OnInit(initData) {
initData.name = "dlg_test";
initData.version = "1.0";
initData.copyright = "";
initData.desc = "";
initData.default_enable = true;
initData.min_version = "13.14.1";
}
// Called to add commands to Opus
function OnAddCommands(addCmdData) {
var cmd = addCmdData.AddCommand();
cmd.name = "dlg_test";
cmd.method = "Ondlg_test";
cmd.desc = "";
cmd.label = "dlg_test";
cmd.template = "";
cmd.hide = false;
cmd.icon = "script";
}
// Implement the dlg_test command
function Ondlg_test(scriptCmdData) {
var dlg = scriptCmdData.func.dlg();
dlg.template = 'dialog1';
dlg.Create();
// dlg.Control('listedit').AddItem('test1'); //same error
dlg.Control('listedit').value = DOpus.NewVector('test1', 'test2'); // same error
//dlg.Control('listedit').value = 'test1'; //same error
dlg.Show();
var msg;
while (true) {
msg = dlg.GetMsg();
if (!msg.result) break;
DOpus.Output('event:' + msg.event );
DOpus.Output('name:' + msg.name );
DOpus.Output('value:' + msg.value );
DOpus.Output('data:' + msg.data );
}
return;
}
dlg_test.opusscriptinstall (1.0 KB)
If the control's type is set to anything other than 'Folders'.
If I set the type to 'Folders', there are no errors. The 'msg' properties are also working after a computer reboot.
And FWIW, I was hoping to test using "Strings," since I wanted to see which dialog appears when pressing the add button (and to check if any event is triggered when trying to add or remove a value, but it seems that isn't the case, no event is fired).
I have also been playing with this control without actually knowing what to expect and consequently not making a lot of progress
. Some code examples would be helpful.
Ok, so now the control is usable in 'Strings' mode.
Leo, Jon here are some ideas that might be worth adding (Or there's maybe a current way to do it?):
- Add a way to hide the 'Add' button, so that only the script can decide which values are listed.
- In 'Strings' Mode, add a 'read-only' option so that it's not possible to edit current values.
- In 'Strings' Mode, add a
msg.click event when you click on a value. (maybe only when 'read-only' is enabled to avoid conflicts with editing).
Thanks.
1 Like
@errante Would you mind posting a working 'strings' sample.
If you grab the one I posted above and set the control to 'Strings', it should work (I think
)
No such luck. Throws an error at line 29.
dlg.Control('listedit').value = DOpus.NewVector('test1', 'test2');
1/04/2025 12:01:37.813 PM dlg_test: Error at line 29, position 2
1/04/2025 12:01:37.813 PM dlg_test: Invalid procedure call or argument (0x800a0005)
Ok, I'm not sure why, but the script from above looks corrupted.
Try this one instead.
dlg_test.opusscriptinstall (1.2 KB)
Edit : I've updated the example so that when you press the 'Clear button', it actually clears the values. Initially, I thought the control would handle that automatically.
It contains a simple example I found about how to get the values and other details related to the control.
However, Jon, I noticed something that might look like a bug—or at least it isn't explained in the release notes:
When 'Edit as text' is enabled, no event is triggered before or after you check/uncheck it in the dialog. This means there's no way to retrieve the values unless you later interact with the control when 'Edit as text' is unchecked.
Thanks for the new additions!
How can I determine which value was clicked? The msg object doesn't seem to provide that information.
Jon, is there a way to make the control (when in Strings Mode) such that the values are not editable and there's no 'Add' button, but they can still be deleted (i.e., each value has a 'delete' button, I mean the 'x' icon)? If not, could this be added for completeness?