msgbox does not show title
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kingsbury Browne
el 6 de Jun. de 2018
Comentada: OCDER
el 6 de Jun. de 2018
When trying to create a message box with a custom title, it does not show up for me.
CreateStruct.Interpreter = 'tex';
CreateStruct.WindowStyle = 'modal';
str_angle = sprintf('%.3f', angle);
str_true_vector_mag = sprintf('%.3f', true_vector_mag);
f = msgbox( {['Angle: ' str_angle '\circ'];['Distance: ' str_true_vector_mag ' m']} , 'Results' , CreateStruct);
I want the title to be 'Results', but for some reason the output does not show the title.
Thank you.
1 comentario
Respuesta aceptada
OCDER
el 6 de Jun. de 2018
Your "Results" text isn't showing because the window is too small. Try making it wider as such:
angle = 30;
true_vector_mag = 15;
CreateStruct.Interpreter = 'tex';
CreateStruct.WindowStyle = 'modal';
str_angle = sprintf('%.3f', angle);
str_true_vector_mag = sprintf('%.3f', true_vector_mag);
f = msgbox({['Angle: ' str_angle '\circ'];['Distance: ' str_true_vector_mag ' m']} , 'Results' , CreateStruct);
f.Position(3) = 200; %<== MAKE FIGURE WIDER
2 comentarios
Walter Roberson
el 6 de Jun. de 2018
Note that the figure titles are handed off to the operating system being used, so the display will vary. On Mac El Capitan, 'Results' does show up, but Windows or Linux might display differently.
OCDER
el 6 de Jun. de 2018
That's a good point - @Kingsbury, the solution I gave may not be robust for other OS with different display settings. Make sure to test it before deploying any software to others.
In Windows, small message boxes do have the title hidden behind the [Minimize, Expand, Close] symbols, which by default are spaced out a lot... A workaround would be to show the text "Results:" along the message inside the msgbox.
Más respuestas (0)
Ver también
Categorías
Más información sobre Title en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!