UITable in App Designer strips leading white space

6 visualizaciones (últimos 30 días)
Felix Widmaier
Felix Widmaier el 10 de Feb. de 2017
Comentada: Usaid el 4 de Ag. de 2022
When using uitable in GUIDE, I was able to pad strings with leading spaces to get them right aligned like in the following (using a monospace font):
1532.000
5.543
26.457
Currently I am considering switching to App Designer. I am using the same space-padded strings but here the uitable seems to strip them off. That is the result looks like the following:
1532.000
5.543
26.457
Is there a way to make uitable in App Designer keep the spaces like it did in GUIDE? Or even better, is there a way to directly right-align the strings without the need of padding?

Respuesta aceptada

Felix Widmaier
Felix Widmaier el 17 de Mzo. de 2017
I asked the same question on StackOverflow and got an answer there. See http://stackoverflow.com/questions/42224921/right-align-values-in-uitable-in-app-designer. Note that the answer there is about right-aligning (which is what I actually want), not about the trimmed spaces.

Más respuestas (1)

Greg
Greg el 27 de Oct. de 2021
I encourage the use of proper horizontal-alignment-right as described in Felix's answer. However, in the event somebody has a real need for leading spaces (and apparently also consecutive interior spacing), use the unicode character 160. It is a special character designed to be blank/invisible but not classified as whitespace.
Example code:
text = ["Seafood";char(160+zeros(1,5)) + "Nachos"];
t = uitable(uigridlayout(uifigure,[1,1]),'Data',text);
  1 comentario
Usaid
Usaid el 4 de Ag. de 2022
I think the character you are refering to is a No-Break Space Unicode character.

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps 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!

Translated by