When attempting to track possible changes to the foreground lister via a detached dialog it appears that foreground lister status is lost. Test button and associated code as attached. Test output as shown. Before the loop starts one of the two listers is identified as foreground but once the dialog loop is entered neither of the two listers is identified as foreground.
fgLister.dcf.txt (4.0 KB)
function OnClick(clickData)
{
var fgLister;
var dlg;
var msg_obj;
var cmd = DOpus.Create().Command;
var iteration = 0;
// --------------------------------------------------------
DOpus.ClearOutput();
// --------------------------------------------------------
fgLister = getFG(); // Determine initial foreground lister
if (fgLister==false) return;
DOpus.output("Initial active tab path = "+fgLister.activetab.path);
dlg = fgLister.dlg
dlg.window = fgLister; // Associate with current lister (keeps on top)
dlg.template = "dialog1";
dlg.title = "Just Testing";
dlg.detach = true;
dlg.create;
dlg.show;
do{
msg_obj = dlg.getmsg();
if (msg_obj==false) break; // User clicked X to close the dialog
iteration++;
DOpus.output("dialog loop iteration "+iteration+" | event = "+msg_obj.event+" | control = "+msg_obj.control);
fgLister = getFG();
if (fgLister!=false) DOpus.output("dialog loop iteration "+iteration+" : active tab path = "+fgLister.activetab.path);
}
while (msg_obj);
// --------------------------------------------------------
}
function getFG()
{
DOpus.listers.update();
for (var i = 0; i < DOpus.listers.count; i++) {
var str = "getFG: DOpus.listers("+i+") = "+DOpus.listers(i)+" | foreground = "+DOpus.listers(i).foreground;
if (DOpus.listers(i).foreground) {
DOpus.listers(i).update();
DOpus.output(str+" | active tab path = "+DOpus.listers(i).activetab.path);
return DOpus.listers(i);
}
else DOpus.output(str);
}
DOpus.output("getFG: No lister is identified as the foreground lister");
return false;
}
<resources>
<resource name="dialog1" type="dialog">
<dialog fontsize="8" height="44" lang="" width="93">
<control height="14" name="button1" title="Click Me" type="button" width="50" x="19" y="16" />
</dialog>
</resource>
</resources>