Difference of behavior depending on the bound key

I tried to reduce the issue I'm having to its simplest expression.
Here it is:

I have a plugin with this code:

function OnInit(data) {
  data.default_enable = true;
}

function OnAddCommands(data) {
  var cmd = data.AddCommand();
  cmd.name = 'Popup';
  cmd.label = 'Test Popup';
  cmd.method = 'OnPopup';
  cmd.hide = false;
}

function OnPopup(data) {
  popup('info', 'First call');
  popup('info', 'Second call');
}

function popup(level, message) {
  var dlg = DOpus.Dlg();
  dlg.title = 'Popup';
  dlg.message = message;
  dlg.buttons = 'OK';
  dlg.icon = level;
  dlg.Show();
}

I bind the hotkey "Shift+O" to the command "Popup"
I bind the hotkey "Shift+N" to the command "Popup"

  • If I press "Shift+O", I get two popups

  • If I press "Shift+N", I get only the second popup (there is before a flash of what is probably the first popup, but it does not stay open)

Any idea on what might be happening?

It's because N will dismiss a simple request dialog which only has OK and/or Cancel buttons and no other controls that can take focus. (N = No = Cancel)

(Avoid hotkeys using Y, Esc, Space or Return with that kind of pop-up, for the same reason.)

1 Like

Thank you for the explanation.
I circumvented the problem like this:

function popup(level, message) {
  var dlg = DOpus.Dlg();
  dlg.title = 'Popup';
  dlg.message = message;
  dlg.buttons = 'OK';
  dlg.icon = level;
  var start = new Date();
  dlg.Show();
  var elapsed = (new Date()) - start;
  if (elapsed < 200)  // the user cannot be that fast
    dlg.Show();
}

The first dismissed dialog still flashes on the screen, but it works.

I think however that N or Y closing a dialog box which does not show buttons "No" or "Yes" is an unexpected behavior (while Esc, Space or Return are expected). Could this be a change request for a future version?

Also, the N was typed before the dialog was shown: shouldn't it have been "gobbled" before the dialog appears?

Y and N are supported for all simple OK/Cancel style confirmation dialogs because some of them ask Yes/No questions, and it's nicer to not have to read and think about each dialog and all of its buttons if you already know you want to dismiss it. It used to be that some confirmation dialogs accepted Y/N and others didn't, and you had to remember which was which.

They don't do anything in dialogs that aren't pure confirmations, i.e. ones that have controls to collect other data.

It's on our list to look at.

You should be able to use the original hotkey now, if you have installed Directory Opus 12.28.4 (Beta)

Yes, I have seen that in the release notes, thank you.
I haven't installed it yet: the betas are stable enough to work with them?

Big problems with the betas are very rare, especially if there hasn't been any posts about issues after a few days. You may run into some untranslated strings if not using Opus in English but that's usually it.

Granted that I don't scratch the surface of the features of Opus, but I routinely use the latest beta.

Probably a good idea to keep the previous installer somewhere so re-installation of the previous version is possible, but it's not likely to be necessary.