﻿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;
}


==SCRIPT RESOURCES
<resources>
	<resource name="dialog1" type="dialog">
		<dialog height="202" lang="english" resize="yes" width="274">
			<control allowchildren="yes" height="194" name="listedit" resize="wh" type="strings" width="266" x="4" y="4" />
		</dialog>
	</resource>
</resources>
