GUIDE changes my figure size and displays wrong information
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a 980 x 720 pixels GUI figure. I need to modify it with GUIDE, but when I open it on my laptop with 1366 x 768 screen resolution I can't see the entire figure; there is a vertical scrolling bar (because the screen resolution is less than the height of the figure), but if I scroll the window I can't see my fig from top to the end.
On the property inspector the figure height is not 702 instead of 720 (??). If I change 702 to 720 the "Position" field on the rigth bottom of the window displays the new value, but on the Property Inspector the new value is again forced to 702!
Scrolling the vertical bar, I checked that the new height is 720, but when I save the figure, GUIDE automatically re-change the height to 702, loosing the 18 pixels height difference.
I guess that this behavior is related to the laptop screen resolution, but It's not acceptable, because if I want to create or modify a figure setting dimensions (to use on another pc with higher resolution) higher than my laptop's screen, I can't.
Moreover, the GUIDE accepts the new dimension but when I save the figure it discards!! See below attached picture with conflicting height values.
How can I do?
Thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1107945/image.jpeg)
2 commentaires
Rik
le 26 Août 2022
Is there a particular reason you're using GUIDE? You will have so many more options if you ditch it, especially in cases like this.
Réponse acceptée
Rik
le 26 Août 2022
I would set the position property in code. You can also do that by putting it in the startup function. You could even first do a check on the resolution of the screen.
OriginalUnits=get(0,'units');
set(0,'Units','Pixels')
ScreenSize=get(0,'ScreenSize');
set(0,'Units',OriginalUnits)
disp(ScreenSize)
if ScreenSize(4)<750
warning('your vertical screen resolution is too low for this app to work properly')
% Set the figure height to something small for your testing
else
warning('your vertical screen resolution is large enough')
% Set the figure height to what you actually need it to be
end
4 commentaires
Rik
le 26 Août 2022
I tend to find myself in one of these two situations:
- I have several uicontrol elements that can all use the same callback, as long as I give them a unique tag.
- I have components that each require their own callback.
In the first case I write a function that will create a grid of components. In the second case, each component requires manual action anyways.
Your GUI is apparently fundamentally different, although you might want to sit down and think whether it really is not possible to categorize your components like this.
I often use GUIDE, but only to get a feel for how it will all fit together, like a glorified MS Paint.
I suspect it will not be worth it for you to use the 'generate code' option that GUIDE allows, but you could have a try.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!