Return to an opened dialog

After i've opened a script dialog and then switched to a different window (DOpus or other), is there a way to...

a) re-activate the dialog using only the keyboard?

b) determine in a different script that the dialog is open and then activate it? (Doing this with a hotkey would be a solution for a) as well...)

making a button up like so

can aslo use Prefs SCRIPTS="My Script.js*"

and setting a Hotkey for it might work - the dialog opens showing the state it was last closed in (so collapsed groups will be collapsed and the last script used highlighted)

Thank you, @galaxyhub, for the suggestion, but perhaps I wasn't clear enough: By "script dialog" I was not referring to the Scripts Preferences but rather to a dialog i created in my own script and then opened with dlg.Show()...

You can kind of do this already with a custom message (added in 13.7.1).

  • Call Dialog.AddCustomMsg to register a custom message
  • When your script starts, use DOpus.SendCustomMsg to send the message to your dialog.
  • If there are no dialogs already open listening for that message, the method will return false - so you know your dialog isn't already running.
  • If SendCustomMsg returns true, you know the dialog already exists, and so shouldn't open a new one.
  • In your message loop, look for the custom message and bring your dialog to the front by setting Dialog.top to true and then to false again.
1 Like

:smile: Thank you for the suggestion. That's an interesting approach. I didn't realize what the purpose of the SendCustomMsg() return value was (it doesn't seem to be documented yet).

I had thought more along the lines of DOpus.dialogs or GetDialogs() but this will keep users from opening the same dialog again and instead show the existing one.

Also, I think I might add a general CustomMsg I can broadcast to all my (major) dialogs and set the focus back on whichever I'm currently working with. I'm constantly Alt+Tabbing and Ctr+Tabbing between windows and it's a little frustrating to have a dialog sitting there right in front of me, unreachable via the keyboard. So near and yet so far... :wink:

We plan to add some things to let you do this in a nicer way, in 13.8.1.

1 Like

Oooh, that sounds promising! :slight_smile:

Meanwhile I experimented a bit and found that the suggested dlg.top = true doesn't work - or rather, it brings the dialog to the front but it doesn't focus it. I then tried some stuff and found that if I change the focus inside the dialog to a different control, the dialog is brought to the front and focused. No "top" needed. I don't really want to change the focus, but for now it's great. And with 13.8.1 just around the corner... :wink:

1 Like