Have you ever needed to move a figure? Perhaps because it is offscreen>? Or at least the menus or close box are not visible? This happens to me from time to time when I get code from someone else who is programming specifically to the size of their display. Working on a laptop, I often have fewer available pixels. What to do?
As you can see from the documentation, movegui gives you a fair amount of latitude for moving your figure around. The two choices I find most useful and easiest to remember for my purposes: onscreen and center. I think you can guess what they each do :-)
Do you use the Function Browser to help you? Do you ever need to reposition "lost" figure windows, like I have? Let me know here.
Get the MATLAB code
Published with MATLAB® R2014a
Comments are closed.
6 CommentsOldest to Newest
movegui definitely looks useful yet pleasingly simple! We try to always create our GUIs in normalised units and define the position vector in GUIDE to open the size our GUI to 90% (or whatever is appropriate) of window size and roughly in the center, but this looks a lot simpler. Especially the ‘North’ option with would get away from the usual problem of the Windows’ taskbar hiding the lower part of a figure.
I’ve never used the function browser, but I may try it. I tend to always have a Help window with lots of tabs open for such purposes.
Under Windows, when I have a window outside the viewport, I do the following trick. Put the window on focus (e.g. alt-tab or clicking on its taskbar button). Press alt-space, m, left-arrow, and then move the mouse (without clicking). Eventually, the window appears, and then single click drops it into place. Alt-space accesses the window menu, m is for move, and then one can move the window with the arrow keys, its a usability feature since windows 3. When you start moving the window, it gets “glued” to the mouse cursor.
I do this very often for “lost” figures in Matlab. Works for windows 7, I haven’t tested it with 8.
Thanks, Adam and Atanas.
Has MOVEGUI been updated to work on a dual-monitor setup?
Version R2012a does not work quite right for me, since the parameter ‘screensize’ does not reflect the dual-monitor setup I have. GUI’s are always moved onto the left monitor.
I edited mine (locally, of course) so that it will expand to the dual-monitor size available.
I do not believe movegui has been updated/changed. Why not put in an enhancement request? That will help facilitate things as the developers will know an user wants the functionality and why. Thanks.
OK Loren, I’ll do that. Thanks