Or is there another way?
Some small example code of what you’re trying to do would be useful here.
When I checked the item and press enter, nothing is output.
function OnClick(clickData)
{
var strValue;
var strName;
var dlg = DOpus.Dlg;
dlg.title = "Directory Opus";
dlg.template = "dlgList";
dlg.detach = true;
dlg.Create();
dlg.Control("static").label = "Topic"; // Topic
dlg.Control("static2").label = "Notes"; // Notes
dlg.Control("static3").label = "D:\\Icons\\Find.png"; // Icon
dlg.Control("static4").label = "D:\\Icons\\Find.png"; // Icon
dlg.Control("static5").label = "D:\\Icons\\Clear.png"; // Clear
updateList(dlg, strName, strValue);
dlg.Show();
while (true) {
var msg = dlg.GetMsg();
if (!msg.result) break;
// Result
DOpus.Output(dlg.result);
if (dlg.result == 1 || dlg.Control("btnOK").focus == true) {
for (i=0; i < dlg.Control("list").count; i ++) {
if (dlg.Control("list").GetItemAt(i).checked == 1) {
DOpus.Output(dlg.Control("list").GetItemAt(i).name);
}
}
}
// Right click list menu
if (msg.event == "rclick" && dlg.Control("list").focus == true) {
var dlgMenu = DOpus.Dlg;
if (dlg.Control("list").value.index > -1) {
//dlgMenu.choices = DOpus.Create.Vector("Edit...", "Delete", "-", "Select Variable", "Deselect Variable", "-", "Select All", "Select None", "-", "Copy Name", "Copy Value", "-", "Clear Filter", "Refresh");
dlgMenu.choices = DOpus.Create.Vector("OK", "Cancel");
//dlgMenu.menu = DOpus.Create.Vector(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
dlgMenu.menu = DOpus.Create.Vector(1, 1);
}
else {
//dlgMenu.choices = DOpus.Create.Vector("New...", "Delete", "-", "Select Variable", "Deselect Variable", "-", "Select All", "Select None", "-", "Copy Name", "Copy Value", "-", "Clear Filter", "Refresh");
dlgMenu.choices = DOpus.Create.Vector("OK", "Cancel");
dlgMenu.menu = DOpus.Create.Vector(1,1);
}
var menuReturn = dlgMenu.Show;
DOpus.Output(menuReturn);
}
// Filter
if (msg.event == "editchange" || msg.event == "click") {
updateList(dlg, strName, strValue);
}
}
}
function updateList(dlg, strName, strValue) {
dlg.Control("list").RemoveItem(-1);
// List items
var text = "tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10, tag11, tag12, tag13, tag14, tag15, tag16, tag17, tag18, tag19, tag20, tag21, tag22, tag23, tag24, tag25, tag26, tag27, tag28, tag29, tag30, tag31, tag32, tag33, tag34, tag35";
var myArray = text.split(", "); // Seprator
for(i = 0; myArray[i]; i++) {
strName = myArray[i];
var strRealName = myArray[i];
var strFilter = dlg.Control("editFilter").value; // Get filter value
strFilter = strFilter.toLowerCase();
if (strRealName.search(strFilter) == -1) {
continue;
}
dlg.Control("list").AddItem(strName); // Add each item to list
strRealName = "";
strFilter = "";
}
dlg.Control("list").columns.AutoSize();
//dlg.Control("staticNotify").label = "Total: " + dlg.Control("list").count;
}
==SCRIPT RESOURCES
<resources>
<resource name="dlgList" type="dialog">
<dialog fontsize="9" height="350" lang="english" resize="yes" standard_buttons="ok,cancel" title="Directory Opus" width="279">
<control halign="left" height="12" name="editFilter" resize="w" tip="Filter" type="edit" width="118" x="25" y="331" />
<control checkboxes="auto" fullrow="yes" height="287" name="list" noheader="yes" resize="wh" type="listview" viewmode="details" width="266" x="6" y="40">
<columns>
<item text="Name" />
<item text="Value" />
<item text="Type" />
<item text="Persist" />
</columns>
</control>
<control enable="no" height="12" name="btnOK" resize="xy" title="&OK" type="button" visible="no" width="42" x="184" y="332" />
<control enable="no" height="12" name="btnClose" resize="xy" title="C&ancel" type="button" visible="no" width="42" x="229" y="332" />
<control halign="left" height="8" name="static" title="Topic" type="static" valign="top" width="236" x="33" y="7" />
<control halign="left" height="13" image="yes" name="static3" title="Static" type="static" valign="top" width="13" x="7" y="5" />
<control halign="left" height="13" image="yes" name="static4" title="Static" type="static" valign="top" width="13" x="8" y="330" />
<control halign="left" height="16" name="static2" title="Notes" type="static" valign="top" width="236" x="33" y="20" />
<control halign="left" height="5" name="static5" title="Static" type="static" valign="top" width="6" x="134" y="335" />
</dialog>
</resource>
</resources>
That’s your own custom dialog, not “the script list dialog”.
I’m not sure if the result property applies to custom dialogs in detached mode. Not at a computer to check that yet. But you can tell which button is pressed because you get an event for it with a detached dialog.
Looking at the code more closely, you seem to be testing dlg.result while the dialog is still open as well, which doesn’t make sense.
Yes thanks, solved it.
function OnClick(clickData)
{
var strValue;
var strName;
var dlg = DOpus.Dlg;
dlg.title = "Directory Opus";
dlg.template = "dlgList";
dlg.detach = true;
dlg.Create();
dlg.Control("static").label = "Topic"; // Topic
dlg.Control("static2").label = "Notes"; // Notes
dlg.Control("static3").label = "D:\\Icons\\Find.png"; // Icon
dlg.Control("static4").label = "D:\\Icons\\Find.png"; // Icon
dlg.Control("static5").label = "D:\\Icons\\Clear.png"; // Clear
updateList(dlg, strName, strValue);
dlg.Show();
while (true) {
var msg = dlg.GetMsg();
if (!msg.result) break;
// Result
if(msg.event == "focus" || dlg.Control("btnOK").focus == true) {
var items = "";
for (i=0; i < dlg.Control("list").count; i ++) {
if (dlg.Control("list").GetItemAt(i).checked == 1) {
items += dlg.Control("list").GetItemAt(i).name;
items+= "\r\n";
}
}
}
// Right click list menu
if (msg.event == "rclick" && dlg.Control("list").focus == true) {
var dlgMenu = DOpus.Dlg;
if (dlg.Control("list").value.index > -1) {
//dlgMenu.choices = DOpus.Create.Vector("Edit...", "Delete", "-", "Select Variable", "Deselect Variable", "-", "Select All", "Select None", "-", "Copy Name", "Copy Value", "-", "Clear Filter", "Refresh");
dlgMenu.choices = DOpus.Create.Vector("OK", "Cancel");
//dlgMenu.menu = DOpus.Create.Vector(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
dlgMenu.menu = DOpus.Create.Vector(1, 1);
}
else {
//dlgMenu.choices = DOpus.Create.Vector("New...", "Delete", "-", "Select Variable", "Deselect Variable", "-", "Select All", "Select None", "-", "Copy Name", "Copy Value", "-", "Clear Filter", "Refresh");
dlgMenu.choices = DOpus.Create.Vector("OK", "Cancel");
dlgMenu.menu = DOpus.Create.Vector(1,1);
}
var menuReturn = dlgMenu.Show;
DOpus.Output(menuReturn);
}
// Filter
if (msg.event == "editchange" || msg.event == "click") {
updateList(dlg, strName, strValue);
}
}
//Output result
if(items != "" && dlg.result == 1) {
var array = items.split("\r\n");
for (i=0; array[i]; i ++) {
DOpus.Output(array[i]);
}
}
}
function updateList(dlg, strName, strValue) {
dlg.Control("list").RemoveItem(-1);
// List items
var text = "tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10, tag11, tag12, tag13, tag14, tag15, tag16, tag17, tag18, tag19, tag20, tag21, tag22, tag23, tag24, tag25, tag26, tag27, tag28, tag29, tag30, tag31, tag32, tag33, tag34, tag35";
var myArray = text.split(", "); // Seprator
for(i = 0; myArray[i]; i++) {
strName = myArray[i];
var strRealName = myArray[i];
var strFilter = dlg.Control("editFilter").value; // Get filter value
strFilter = strFilter.toLowerCase();
if (strRealName.search(strFilter) == -1) {
continue;
}
dlg.Control("list").AddItem(strName); // Add each item to list
strRealName = "";
strFilter = "";
}
dlg.Control("list").columns.AutoSize();
//dlg.Control("staticNotify").label = "Total: " + dlg.Control("list").count;
}
==SCRIPT RESOURCES
<resources>
<resource name="dlgList" type="dialog">
<dialog fontsize="9" height="350" lang="english" resize="yes" title="Directory Opus" width="279">
<control halign="left" height="12" name="editFilter" resize="w" tip="Filter" type="edit" width="118" x="25" y="331" />
<control checkboxes="auto" fullrow="yes" height="287" name="list" noheader="yes" resize="wh" type="listview" viewmode="details" width="266" x="6" y="40">
<columns>
<item text="Name" />
<item text="Value" />
<item text="Type" />
<item text="Persist" />
</columns>
</control>
<control close="1" default="yes" height="12" name="btnOK" resize="xy" title="&OK" type="button" width="42" x="184" y="332" />
<control close="0" height="12" name="btnClose" resize="xy" title="C&ancel" type="button" width="42" x="229" y="332" />
<control halign="left" height="8" name="static" title="Topic" type="static" valign="top" width="236" x="33" y="7" />
<control halign="left" height="13" image="yes" name="static3" title="Static" type="static" valign="top" width="13" x="7" y="5" />
<control halign="left" height="13" image="yes" name="static4" title="Static" type="static" valign="top" width="13" x="8" y="330" />
<control halign="left" height="16" name="static2" title="Notes" type="static" valign="top" width="236" x="33" y="20" />
<control halign="left" height="5" name="static5" title="Static" type="static" valign="top" width="6" x="134" y="335" />
</dialog>
</resource>
</resources>