> On Dec 31, 2023, at 8:07 PM, Fred Damen <[email protected]> wrote:
> 
> Greetings,
> 
> In my attempts to handle GenericDialog(s) oversized windows, I was
> perusing the code for GenericDialog and discovered two things I did not
> know you should be able to do but didn't work...
> 
> 1) using addToSameRow() just before showDialog(), which I assume is
> intended to put Ok/Cancel buttons on the same row as the last defined
> widget. The only problem, the Ok/Cancel buttons are put just past the edge
> of the window on the same row.

The ImageJ 1.54i3 daily build fixes a bug that caused the “OK” and “Cancel” 
buttons to be beyond the edge of GenericDialog windows when addToSameRow() was 
called just before showDialog(). The addToSameRow() method was not intended to 
put “OK” and “Cancel” buttons on the same row as the last defined widget.

> 2) I notice that the Shift-Ctrl-G sequence should cause a full screen
> capture.  I tried this in a few of my existing GeneriDialog(s) and nothing
> happened, although it seems to work in the provided example.

Shift+Ctrl+G works for me in GenericDialogs to capture the screen. Crop to get 
just the window.

-wayne


> This is not a
> problem for me since this is not specific to the GenricDialog. What would
> be nice is for pressing Ctrl-C within the GenericDialog would screen grab
> just the displayed GenericDialog; where the OS window dressings are
> desired. I would use this for preparing documentation for my plugins.
> 
> Thanks for listening,
> 
> Fred
> 
> 
> /////// 1
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> 
> public class TestaddToSameRow implements PlugIn {
> 
>  public void run(String arg) {
>     GenericDialog gd = new GenericDialog("test addToSameRow Ok");
>     gd.addMessage("This is a widget to have something in the
> GenericDialog");
>     gd.addMessage("Status Line");
>     gd.addToSameRow();
>     gd.showDialog();
>     }
> 
>  }
> 
> // 2
> //Works on both GenericDialog(s) and ImageWindow(s)
>  public static ImagePlus snap(Window win) {
>     try {
>        Rectangle r = new Rectangle(win.getLocation(),win.getSize());
>        new Robot().waitForIdle();
>        ImagePlus imp = new ImagePlus("Snapshot",new
> Robot().createScreenCapture(r));
>        return imp;
>        }
>     catch(Exception e) {
>        IJ.showStatus("Could not grab snapshot of window");
>        }
>     return null;
>     }

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

Reply via email to