Re: How to bring a window to the front

Posted by CARL Philippe (LBP) on
URL: http://imagej.273.s1.nabble.com/How-to-bring-a-window-to-the-front-tp5022281p5022282.html

Dear Aryeh,
I'm almost sure that the macro code selectWindow("name") brings the window in front.
And selectWindow("name") corresponds to the "public static void selectWindow(int id)" method of the IJ class.
And by looking at its code I see (imp being an ImagePlus element):
    ImageWindow win = imp.getWindow();
    if (win!=null) {
            win.toFront();
            WindowManager.setWindow(win);
    }
At ladt and not at least, "toFront" is from the java.awt.Window class with the following definition "If this Window is visible, brings this Window to the front and may make it the focused Window" within:
https://docs.oracle.com/javase/7/docs/api/java/awt/Window.html#toFront()
which makes all what I wrote CQFD!
Have a nice day.    
Kindest regards,
Philippe


Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84

----- Mail original -----
De: "aryeh" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Mercredi 26 Juin 2019 11:01:26
Objet: How to bring a window to the front

I am trying to bring a window to the front, using

     inputWin = WindowManager.getWindow(inputImp.getTitle())
     print inputImp.getTitle()  # verifies that this is the window I want
     WindowManager.setWindow(inputWin)
     WindowManager.setCurrentWindow(inputWin)
     WindowManager.repaintImageWindows()
     print WindowManager.getActiveWindow()  # verifies that the correct
title is in fact printed

The image does not get put in front, even though the last line confirms
that it is the active image.
Where have I gone wrong?

tnx in advance

--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html