Get Focus on dialog

A button of my viewer attached dialog calls "Show USEEXISTING". This causes the viewer to get the focus. Is it possible to avoid this? Something like dlg.[always]ontop = True would be nice. I couldn't find anything that brings the dialog back to front without having to click into it.

Problem solved! Executing dlg.Control("edit1").focus = True after every "Show" command gives the focus back to the dialog.

If the viewer is already open, you can ask it to load an image, which won't change the focus (so you don't need to change it back afterwards):

(JScript)

DOpus.Viewers.LastActive.Command("open,C:\\test.png");

(If your script is launched from the viewer, then you'll already have the viewer object via that and should use that object instead of the LastActive viewer, in case there's more than one viewer in use at the same time.)

Thanks, got it working.