I did not find in the documentation. What is the meaning of set(0,....). What does 0 signify?
Mostrar comentarios más antiguos
I did not find in the documentation. What is the meaning of set(0,....). What does 0 signify? I know that it is the handle? Is the first handle always 0? What does this mean?
Respuesta aceptada
Más respuestas (1)
Titus Edelhofer
el 18 de En. de 2015
Hi,
the 0 is the root of the graphics system. It contains information like screen resolution:
get(0)
CallbackObject: []
Children: []
CurrentFigure: []
FixedWidthFontName: 'Courier New'
HandleVisibility: 'on'
MonitorPositions: [1 1 1920 1080]
Parent: []
PointerLocation: [913 357]
ScreenDepth: 32
ScreenPixelsPerInch: 96
ScreenSize: [1 1 1920 1080]
ShowHiddenHandles: 'off'
Tag: ''
Type: 'root'
Units: 'pixels'
UserData: []
Since R2014b handles are objects and not plain numbers. So you can still use the 0 for backward compatibility, but preferred is to use groot instead.
doc groot
Titus
3 comentarios
Image Analyst
el 18 de En. de 2015
titus, could you somehow use this to fix the messed up size normalization in GUIDE? You know, like when you set up your GUI layout so that all the controls have their 'units' property set to normalized, and it looks great on your computer, but when someone else runs it on their computer with a different screen size, all the controls are messed up, like they overlap, or the text labels are clipped, etc.? I compile my apps and usually the end-user has less screen resolution than me and a different video adapter, and the layout is all messed up - it's not normalizing properly for them.
Titus Edelhofer
el 18 de En. de 2015
Hi IA,
yes, you can. Normalized works fine, but as you already observed, just to some extent. Designing your app on Full HD and run it on a 1024x768 will probably not work.
What I do is to add some switchyard when opening the app, something like
res = get(groot, 'ScreenSize');
if res(3)>=1920
% Full HD
% Set some properties accordingly
elseif res(3)>=1400
% This used to be the resolution of my laptop
else
warning('Low resolution, app will look ugly.');
end
Titus
Image Analyst
el 18 de En. de 2015
Well yes, but it's the "Set some properties accordingly" part that I need. I don't know what to change to fix it. I imagine that if the low res computer were setting up the GUI with GUIDE, they could get it to look fine, so what are the properties that I need to change? Just bump down all the font sizes or something? Is there something more global than that? I don't want to manually fix the properties of every single one of the 20 or 30 controls on the GUI if possible.
Categorías
Más información sobre Migrate GUIDE Apps en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!