Click to See Complete Forum and Search --> : RichTextBox


Pasi Salminen
July 15th, 1999, 05:09 AM
Hello!

In my VB5 programm the RichTextBox OCX Control always wraps the text and uses not horizontal scrollbar of the control.
I want to use horizontal scrollbar and no wordwraps! Is it possible?
Version of my RichTextBox OCX Control is 5.01.4319.

Thanks berore hand!

Pasi Salminen
pasisalminen@hotmail.com

Mikesc
July 15th, 1999, 09:58 AM
Just change the ScrollBars property to whatever you like and that will take care of the first problem. For the second problem, if you set the MultiLine property to false, you won't have to worry about wordwrapping but then you won't be able to enter to the next line either. Try looking through the help files, you'll find more info there.

Pasi Salminen
July 16th, 1999, 12:23 AM
Hi!

I have set the Multiline property to True and the ScrollBars property to rftBoth. But still the horizontal scrollbar is never in use. Why? The OCX Control always wraps long rows to several rows.

Pasi Salminen
pasisalminen@hotmail.com

Mikesc
July 16th, 1999, 09:43 AM
You need to set the multiline property to FALSE not true. If you want a horizontal scrollbar, set the scroll bar property accordingly. The scrollbar will only appear if the length of the text entered exceeds the width of the control.

Ravi Kiran
July 19th, 1999, 01:54 AM
Hi,

Your observation that 'you will only get Horizontal scroll bar only if the text is outside the window' is very correct. But the text never goes outside the window, then how to?!

It is because, Richedit text box ( or even Multiline text box) has a "Margined" area and by default the left and right Margins concide with the window area.

So you will have to explicitelyset the Marigns outside the Window to get the scrollbars. To do this you have to send a message EM_SETMARGINS. and EM_GETMARGINS for retrieving the margin area.

Ofcouse you will also have to set the ScrollBar property also.

Look into MSDN for finding out what are the wParam and lParam for this message. Obviously one of them would be the Margin positions.:-)

I will give a try too.. get back to me if you want code.

Ravi Kiran

Lothar Haensler
July 19th, 1999, 02:21 AM
Wow, that's cool. I have been banging my head against this and couldn't get a solution.

You are right. You need to set the margins.
But, you don't have to use the API. The RichTextbox control has a RightMargin property that you can set.

Pasi Salminen
July 19th, 1999, 06:37 AM
That resolved my problem!

Thank you very much!

Pasi Salminen
pasisalminen@hotmail.com