Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Slider in GUIDE

Subject: Slider in GUIDE

From: Mathew Thomas

Date: 28 Jan, 2010 00:07:03

Message: 1 of 11

Hey all !!!!

Does anyone know how I can make the text entered in a text-box go to the next line automatically when it reaches the width of the edit box. Right now, it just keeps going in the same line.

eg, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ......................
(it should be) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                   aaaaaaaaaaaaaaaaaaaaaaa.

Thanks,

Mathew

Subject: Slider in GUIDE

From: Walter Roberson

Date: 28 Jan, 2010 00:29:29

Message: 2 of 11

Mathew Thomas wrote:

> Does anyone know how I can make the text entered in a text-box go to the
> next line automatically when it reaches the width of the edit box. Right
> now, it just keeps going in the same line.


You will either need to go in at the Java level, or you will need to use
  a KeyPressFcn callback for the uicontrol. If you use the KeyPressFcn,
you will have to track every key press manually and figure out what to
do with it, as Matlab has an oddity that within the KeyPressFcn
callbacks, the String property of the control might not be up-to-date
(and besides, if the user presses backspace or delete, you might need to
  go back to the previous line after having already wrapped...)

Subject: Slider in GUIDE

From: Matt Fig

Date: 28 Jan, 2010 00:32:20

Message: 3 of 11

I am a little confused about what you want. Your subject says slider, but your message seems to imply an editbox.

Try this:

>>uicontrol('sty','ed','min',0,'max',2) % Now type away!!

Subject: Slider in GUIDE

From: Mathew Thomas

Date: 28 Jan, 2010 00:54:03

Message: 4 of 11

"Matt Fig" <spamanon@yahoo.com> wrote in message <hjqluk$gmb$1@fred.mathworks.com>...
> I am a little confused about what you want. Your subject says slider, but your message seems to imply an editbox.
>
> Try this:
>
> >>uicontrol('sty','ed','min',0,'max',2) % Now type away!!

Hey Matt!!!

I meant edit box. The issue is I want the message to stop at the end of the box and continue at the next line (ie, same as pressing "enter" in Word or so)....

Thanks,

Mathew

Subject: Slider in GUIDE

From: Walter Roberson

Date: 28 Jan, 2010 01:02:07

Message: 5 of 11

Mathew Thomas wrote:

> I meant edit box. The issue is I want the message to stop at the end of
> the box and continue at the next line (ie, same as pressing "enter" in
> Word or so)....

And is it intended to do that even if the character presses continues
the "word" that is being typed? If so, then should that word be brought
down to the beginning of next line if it is not already the last word on
the line? What should happen if the word being constructed is already
the first word on the line and you keep typing non-whitespace -- should
it just break the word at that point?

If you want to break the word at an arbitrary point, then you are going
to need to use one of the suggestions I indicated earlier.

Subject: Slider in GUIDE

From: Mathew Thomas

Date: 28 Jan, 2010 01:12:02

Message: 6 of 11

Walter Roberson <roberson@hushmail.com> wrote in message <hjqnmg$ef7$1@canopus.cc.umanitoba.ca>...
> Mathew Thomas wrote:
>
> > I meant edit box. The issue is I want the message to stop at the end of
> > the box and continue at the next line (ie, same as pressing "enter" in
> > Word or so)....
>
> And is it intended to do that even if the character presses continues
> the "word" that is being typed? If so, then should that word be brought
> down to the beginning of next line if it is not already the last word on
> the line? What should happen if the word being constructed is already
> the first word on the line and you keep typing non-whitespace -- should
> it just break the word at that point?
>
> If you want to break the word at an arbitrary point, then you are going
> to need to use one of the suggestions I indicated earlier.

Hey Walter!!!

Yes. You understood it right. It should break at around the same position for each line. I will try the methods you gave me earlier. Let me know if anything else pops-up in your head.

Thanks,

Mathew

Subject: Slider in GUIDE

From: Mathew Thomas

Date: 28 Jan, 2010 01:15:22

Message: 7 of 11

Walter Roberson <roberson@hushmail.com> wrote in message <hjqnmg$ef7$1@canopus.cc.umanitoba.ca>...
> Mathew Thomas wrote:
>
> > I meant edit box. The issue is I want the message to stop at the end of
> > the box and continue at the next line (ie, same as pressing "enter" in
> > Word or so)....
>
> And is it intended to do that even if the character presses continues
> the "word" that is being typed? If so, then should that word be brought
> down to the beginning of next line if it is not already the last word on
> the line? What should happen if the word being constructed is already
> the first word on the line and you keep typing non-whitespace -- should
> it just break the word at that point?
>
> If you want to break the word at an arbitrary point, then you are going
> to need to use one of the suggestions I indicated earlier.

Hey Walter!!!

Yes. You understood it right. It should break at around the same position for each line. I will try the methods you gave me earlier. Let me know if anything else pops-up in your head.

Thanks,

Mathew

Subject: Slider in GUIDE

From: Matt Fig

Date: 28 Jan, 2010 01:24:03

Message: 8 of 11

I guess I don't see how the suggestion I gave above doesn't fit the requirements. It certainly is a lot simpler than going into the JAVA and or using keypressfcns.
About the only thing that could make it look more like word is to have the horizontal alignment set to left, as in:

uicontrol('style','edit','min',0,'max',2,'horizontala','left');

Subject: Slider in GUIDE

From: Mathew Thomas

Date: 28 Jan, 2010 01:24:03

Message: 9 of 11

It works if we change the Max to 2. Works well !!!

Thanks,
Mathew

Subject: Slider in GUIDE

From: Steven Lord

Date: 28 Jan, 2010 15:18:59

Message: 10 of 11


"Mathew Thomas" <mathew99@gmail.com> wrote in message
news:hjqkf7$eft$1@fred.mathworks.com...
> Hey all !!!!
>
> Does anyone know how I can make the text entered in a text-box go to the
> next line automatically when it reaches the width of the edit box. Right
> now, it just keeps going in the same line.
> eg, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ......................
> (it should be) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaa.

Who's entering the text in the text box, a user or the program? In the
latter case, use TEXTWRAP.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/textwrap.html

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Slider in GUIDE

From: Yair Altman

Date: 1 Feb, 2010 17:46:23

Message: 11 of 11

"Steven Lord" <slord@mathworks.com> wrote in message <hjs9sv$r7p$1@fred.mathworks.com>...
>
> "Mathew Thomas" <mathew99@gmail.com> wrote in message
> news:hjqkf7$eft$1@fred.mathworks.com...
> > Hey all !!!!
> >
> > Does anyone know how I can make the text entered in a text-box go to the
> > next line automatically when it reaches the width of the edit box. Right
> > now, it just keeps going in the same line.
> > eg, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> > ......................
> > (it should be) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> > aaaaaaaaaaaaaaaaaaaaaaa.
>
> Who's entering the text in the text box, a user or the program? In the
> latter case, use TEXTWRAP.
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/textwrap.html
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


Here's an article describing how to customize the Matlab multi-line editbox text-wrap behavior (which is closely related to its horizontal scrollbar policy): http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us