I tried for about half an hour to display a notification message via Dlg.NotifyIcon and its notify method. No success. Is it somehow broken or is there something I missed? dlg_test.opusscriptinstall (1.1 KB)
Also, if you don't set an Image object as the dialog's icon, Dlg.NotifyIcon (and the script) will fail. Is that expected?
Script's code
// Implement the dlg_test command
function Ondlg_test(scriptCmdData) {
var dlg = scriptCmdData.func.Dlg();
dlg.template = 'dialog1';
dlg.icon = DOpus.LoadImage(DOpus.Aliases('home').path + '\\dopusrt.exe,5');
dlg.title = 'dlg_test';
dlg.Create();
dlg.NotifyIcon('add', 'starting dialog...'); // If you don't explicitly set an Image object as `dlg.icon`, the script will fail here.
dlg.Show();
var msg;
while (true) {
msg = dlg.GetMsg();
if (!msg.result) break;
if (msg.event == 'click') {
DOpus.Output(dlg.Control(msg.name).label + ' was pressed!');
dlg.NotifyIcon('notify', dlg.title, dlg.Control(msg.name).label + ' was pressed!', 'n'); // does nothing
}
}
return;
}
Maybe notifications from Opus are blocked on your system? Check the Notifications system control panel.
Well to add a notification icon there has to be an icon to use. If you don't provide one for the NotifyIcon method then it'll use the dialog's icon, but if there isn't one there either then it will fail, yes.
Yes. But since you can leave the dialog's icon unset, and in that case, the dialog will use the default Opus icon, I imagined it would be the same. It's not a problem, anyway.
Weird. I don't have Opus notification blocked, since I often use DOpus.Notify and this one does show if I use that instead.