I am having issues with the new ability to disable items in listviews. The following button/code gives an example of the issue. I create a dialog with an automatic checkbox listview, add three items, one of which is disabled with its checkbox set to 3 - disabled and unchecked.
When you close the dialog it outputs the current status of the .checked state for all items.
The disabled and unchecked item reports the same as the checked items. Am I doing something wrong here please?
function OnClick(clickData)
{
var dlg = DOpus.Dlg();
dlg.title = "Test";
dlg.template = "dialog1";
dlg.detach = true;
dlg.want_close = true;
dlg.Create();
dlg.Control("list").columns.AddColumn("Col 1");
var i = dlg.Control("list").AddItem("Folder 1");
var i = dlg.Control("list").AddItem("Folder 2");
dlg.Control("list").GetItemAt(i).disabled = true;
dlg.Control("list").GetItemAt(i).checked = 3;
var i = dlg.Control("list").AddItem("Folder 3");
dlg.Control("list").columns.AutoSize();
dlg.Show();
while (true) {
var msg = dlg.GetMsg();
if (!msg.result) break;
if (msg.event == "close") {
for (i=0; i < dlg.Control("list").count; i ++) {
DOpus.Output(dlg.Control("list").GetItemAt(i).checked);
}
dlg.EndDlg();
}
}
}```
Looks like a bug with the "checked" property; it's being reported as a bool, not an int, so only reports zero or non-zero. Will fix this in the next update. I don't think this has anything to do with the new disable feature for items though.
Which uses this code and doesn't correctly report the disabled boolean.
function OnClick(clickData)
{
var dlg = DOpus.Dlg();
dlg.title = "Test";
dlg.template = "dialog1";
dlg.detach = true;
dlg.want_close = true;
dlg.Create();
dlg.Control("list").columns.AddColumn("Col 1");
var i = dlg.Control("list").AddItem("Folder 1");
var i = dlg.Control("list").AddItem("Folder 2");
dlg.Control("list").GetItemAt(i).disabled = true;
//dlg.Control("list").GetItemAt(i).checked = 3;
var i = dlg.Control("list").AddItem("Folder 3");
dlg.Control("list").columns.AutoSize();
DOpus.ClearOutput();
dlg.Show();
while (true) {
var msg = dlg.GetMsg();
if (!msg.result) break;
if (msg.event == "close") {
for (i=0; i < dlg.Control("list").count; i ++) {
DOpus.Output(dlg.Control("list").GetItemAt(i).disabled);
}
dlg.EndDlg();
}
}
}
I just noticed too that integer and boolean variables are now reporting themselves as "int" and "bool" instead of "number" and "boolean" which confused me for a bit.