Recalling a form in Opus

I don't think you can reliably re-use the exact same dlg object, but you can create a second dlg object for the same dialog without any issues.

Example using a detached dialog:

function OnClick(clickData)
{
	for (var showCount = 0; showCount < 2; ++showCount)
	{
	    var Dlg = DOpus.Dlg;
	    Dlg.window = clickData.func.sourcetab;
	    Dlg.template = "dialog1";
	    Dlg.detach = true;
		Dlg.Create();

		var listview = Dlg.Control("listview1");
		var i = listview.AddItem("Line 1");
		listview.GetItemAt(i).subitems(0) = "L1.0";
		listview.GetItemAt(i).subitems(1) = "L1.1";
		i = listview.AddItem("Line 2");
		listview.GetItemAt(i).subitems(0) = "L2.0";
		listview.GetItemAt(i).subitems(1) = "L2.1";

	    Dlg.Show();
	    while (true)
		{
	        var Msg = Dlg.GetMsg();
	        if (!Msg.result) break;
	        DOpus.Output("Msg Event = " + Msg.event);
			if (Msg.event == "click" && Msg.control == "Autosize")
			{
				listview.columns.AutoSize();
			}
		}
	    DOpus.Output("Return code = " + Dlg.result);
    }
}
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>New Button</label>
	<icon1>#newcommand</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>function OnClick(clickData)</instruction>
		<instruction>{</instruction>
		<instruction>	for (var showCount = 0; showCount &lt; 2; ++showCount)</instruction>
		<instruction>	{</instruction>
		<instruction>	    var Dlg = DOpus.Dlg;</instruction>
		<instruction>	    Dlg.window = clickData.func.sourcetab;</instruction>
		<instruction>	    Dlg.template = &quot;dialog1&quot;;</instruction>
		<instruction>	    Dlg.detach = true;</instruction>
		<instruction>		Dlg.Create();</instruction>
		<instruction />
		<instruction>		var listview = Dlg.Control(&quot;listview1&quot;);</instruction>
		<instruction>		var i = listview.AddItem(&quot;Line 1&quot;);</instruction>
		<instruction>		listview.GetItemAt(i).subitems(0) = &quot;L1.0&quot;;</instruction>
		<instruction>		listview.GetItemAt(i).subitems(1) = &quot;L1.1&quot;;</instruction>
		<instruction>		i = listview.AddItem(&quot;Line 2&quot;);</instruction>
		<instruction>		listview.GetItemAt(i).subitems(0) = &quot;L2.0&quot;;</instruction>
		<instruction>		listview.GetItemAt(i).subitems(1) = &quot;L2.1&quot;;</instruction>
		<instruction />
		<instruction>	    Dlg.Show();</instruction>
		<instruction>	    while (true)</instruction>
		<instruction>		{</instruction>
		<instruction>	        var Msg = Dlg.GetMsg();</instruction>
		<instruction>	        if (!Msg.result) break;</instruction>
		<instruction>	        DOpus.Output(&quot;Msg Event = &quot; + Msg.event);</instruction>
		<instruction>			if (Msg.event == &quot;click&quot; &amp;&amp; Msg.control == &quot;Autosize&quot;)</instruction>
		<instruction>			{</instruction>
		<instruction>				listview.columns.AutoSize();</instruction>
		<instruction>			}</instruction>
		<instruction>		}</instruction>
		<instruction>	    DOpus.Output(&quot;Return code = &quot; + Dlg.result);</instruction>
		<instruction>    }</instruction>
		<instruction>}</instruction>
		<instruction>==SCRIPT RESOURCES</instruction>
		<instruction>&lt;resources&gt;</instruction>
		<instruction>	&lt;resource name=&quot;dialog1&quot; type=&quot;dialog&quot;&gt;</instruction>
		<instruction>		&lt;dialog fontsize=&quot;8&quot; height=&quot;114&quot; lang=&quot;english&quot; resize=&quot;yes&quot; standard_buttons=&quot;cancel&quot; width=&quot;228&quot;&gt;</instruction>
		<instruction>			&lt;control height=&quot;84&quot; name=&quot;listview1&quot; nosortheader=&quot;yes&quot; resize=&quot;wh&quot; type=&quot;listview&quot; viewmode=&quot;details&quot; width=&quot;216&quot; x=&quot;6&quot; y=&quot;6&quot;&gt;</instruction>
		<instruction>				&lt;columns&gt;</instruction>
		<instruction>					&lt;item text=&quot;Test Column 1&quot; /&gt;</instruction>
		<instruction>					&lt;item text=&quot;Test Column 2&quot; /&gt;</instruction>
		<instruction>					&lt;item text=&quot;Test Column 3&quot; /&gt;</instruction>
		<instruction>				&lt;/columns&gt;</instruction>
		<instruction>			&lt;/control&gt;</instruction>
		<instruction>			&lt;control height=&quot;14&quot; name=&quot;Autosize&quot; resize=&quot;y&quot; title=&quot;Autosize&quot; type=&quot;button&quot; width=&quot;50&quot; x=&quot;6&quot; y=&quot;96&quot; /&gt;</instruction>
		<instruction>		&lt;/dialog&gt;</instruction>
		<instruction>	&lt;/resource&gt;</instruction>
		<instruction>&lt;/resources&gt;</instruction>
	</function>
</button>