GUIDE changes my figure size and displays wrong information

12 vues (au cours des 30 derniers jours)
Giuela
Giuela le 25 Août 2022
Commenté : Rik le 26 Août 2022
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
  2 commentaires
Rik
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.
See also this thread.
Giuela
Giuela le 26 Août 2022
thanks, Rik.
I have lot of figures created with GUIDE and I'v never had problems. I know in future I shall use app designer, but now I need to use the gui builder. Which options do you mean?
The problem is that GUIDE is still available, so I guess that it must work correctly. Could you help me?
I need an explanation about this strange behaviour

Connectez-vous pour commenter.

Réponse acceptée

Rik
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)
1 1 1920 1200
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
Warning: your vertical screen resolution is large enough
  4 commentaires
Giuela
Giuela le 26 Août 2022
I use GUIDE for figures with a lot of objects, because it takes long time to do it programmatically, expecially when you have to decide the objects position in the figure. Of course, for little figures I prefer build them directly with code.
Thank you for your suggestions
Rik
Rik le 26 Août 2022
I tend to find myself in one of these two situations:
  1. I have several uicontrol elements that can all use the same callback, as long as I give them a unique tag.
  2. 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by