Fixing Matlab GUI Resize Problem: Repositioning and Full Screen Issues

  • MATLAB
  • Thread starter boolean_logic
  • Start date
  • Tags
    Gui Matlab
Both of these options may provide a more reliable solution for repositioning your GUI.In summary, there are two potential solutions for repositioning your GUI: using the WindowAPI or the Java AWT/Swing APIs. These options provide functions for setting window size, position, and appearance properties. This may help resolve any unexpected positioning issues you are experiencing.
  • #1
boolean_logic
2
0
I have been trying the following to reposition my GUI (within the OpeningFcn):

h=get(handles.figure1,'Position');
set(0,'Units','normalized')
S = get(0,'screensize');
width = h(3);
height=h(4);
x = (S(3) - width)/2;
y = (S(4) - height)/2;
set(handles.figure1,'Position',[x,y,width,height]);

However this results in the Gui being position in an unexpected position. I am not sure why this is but the problem persists even if I replace set(handles.figure1,'Position',[x,y,width,height]) with set(handles.figure1,'Position',S) - I expected this change in code to result in a full screen gui however the position was offset (the width and height appeared correct though).
 
Physics news on Phys.org
  • #2
I would suggest using the WindowAPI or the Java AWT/Swing APIs. The WindowAPI provides a set of functions to manipulate windows, including setting size and position. The Java AWT/Swing APIs provide a more comprehensive set of functions for manipulating windows, including setting size, position, and various properties related to window appearance.
 

Related to Fixing Matlab GUI Resize Problem: Repositioning and Full Screen Issues

1. How do I fix the issue of my Matlab GUI not resizing properly?

To fix this issue, you can adjust the 'ResizeFcn' property of your GUI's figure. This function will be automatically called whenever the figure is resized, allowing you to reposition your components accordingly.

2. Why is my Matlab GUI not repositioning correctly when I resize it?

This could be due to the fact that your GUI's components are not properly aligned using 'Position' or 'OuterPosition' properties. Make sure to use these properties to specify the position of your components relative to the figure's size.

3. How can I make my Matlab GUI resize to fit the screen when I switch to full screen mode?

To achieve this, you can set the 'Units' property of your figure to 'normalized' and specify the 'Position' property with values between 0 and 1. This will allow your GUI to resize proportionally when switching to full screen mode.

4. My Matlab GUI is not displaying properly on different screen resolutions. How can I fix this?

You can use the 'ScreenSize' function to get the dimensions of the screen and then adjust your GUI's components accordingly. Additionally, setting the 'Units' property of your figure to 'pixels' can help ensure consistent display on different screen resolutions.

5. Is there a way to make my Matlab GUI automatically adjust to different screen sizes?

Yes, you can use the 'WindowResizeFcn' property of your figure to specify a function that will be called whenever the figure is resized. This function can be used to reposition and resize your GUI's components based on the new figure size.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
619
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
774
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top