From: jens on
Hi All

I want to align some strings in a GUI. I have the following example:


h={'Product Name' 'Price' 'Code'}
j={'Newcastle' '20' 'EU20'}
bongo=[h ;j]

set(h,'string',sprintf('%s %s\n',bongo{:}))% h is a handle to a text box.


I want the left column to be vertical aligned. Both h and j har cellarrays which contains many numbers and characters. Maybe I could make some code that extend the strings in the left column if the length of the strings are different?

Best Regards

Jens
From: jens on
"jens " <pascal(a)hotmail.com> wrote in message <ht8ajr$sfr$1(a)fred.mathworks.com>...
> Hi All
>
> I want to align some strings in a GUI. I have the following example:
>
>
> h={'Product Name' 'Price' 'Code'}
> j={'Newcastle' '20' 'EU20'}
> bongo=[h ;j]
>
> set(h,'string',sprintf('%s %s\n',bongo{:}))% h is a handle to a text box.
>
>
> I want the left column to be vertical aligned. Both h and j har cellarrays which contains many numbers and characters. Maybe I could make some code that extend the strings in the left column if the length of the strings are different?
>
> Best Regards
>
> Jens

Hi

Does anybody know how to fix my problem?

/jens
From: Walter Roberson on
jens wrote:
> "jens " <pascal(a)hotmail.com> wrote in message
> <ht8ajr$sfr$1(a)fred.mathworks.com>...

>> I want to align some strings in a GUI. I have the following example:
>>
>>
>> h={'Product Name' 'Price' 'Code'}
>> j={'Newcastle' '20' 'EU20'}
>> bongo=[h ;j]
>> set(h,'string',sprintf('%s %s\n',bongo{:}))% h
>> is a handle to a text box.
>>
>> I want the left column to be vertical aligned. Both h and j har
>> cellarrays which contains many numbers and characters. Maybe I could
>> make some code that extend the strings in the left column if the
>> length of the strings are different?

> Does anybody know how to fix my problem?

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/uicontrol_props.html#bqxoims

HorizontalAlignment

left | {center} | right

Horizontal alignment of label string. This property determines the
justification of the text defined for the String property (the uicontrol
label):

*

left — Text is left justified with respect to the uicontrol.
*

center — Text is centered with respect to the uicontrol.
*

right — Text is right justified with respect to the uicontrol.

On Microsoft Windows systems, this property affects only edit and
text uicontrols.
From: Yair Altman on
Walter Roberson <roberson(a)hushmail.com> wrote ...
> HorizontalAlignment
> left | {center} | right
> On Microsoft Windows systems, this property affects only edit and
> text uicontrols.

Since the OP had a textbox, this will indeed solve the OP's problem. But for anyone who is interested, the HorizontalAlignment can be set for all other uicontrols using their underlying Java component, which can be retrieved via the FindJObj utility on the File Exchange.

The same Java object can also be used to set the VerticalAlignment property and quite a few other useful properties that Matlab does not expose.

Yair Altman
http://UndocumentedMatlab.com
From: jens on
"Yair Altman" <altmanyDEL(a)gmailDEL.comDEL> wrote in message <htc2hs$2mv$1(a)fred.mathworks.com>...
> Walter Roberson <roberson(a)hushmail.com> wrote ...
> > HorizontalAlignment
> > left | {center} | right
> > On Microsoft Windows systems, this property affects only edit and
> > text uicontrols.
>
> Since the OP had a textbox, this will indeed solve the OP's problem. But for anyone who is interested, the HorizontalAlignment can be set for all other uicontrols using their underlying Java component, which can be retrieved via the FindJObj utility on the File Exchange.
>
> The same Java object can also be used to set the VerticalAlignment property and quite a few other useful properties that Matlab does not expose.
>
> Yair Altman
> http://UndocumentedMatlab.com

Thanks Yair and Walter

Jens
 | 
Pages: 1
Prev: LEVMAR with MEX
Next: NTC Thermistor Model