• Welcome to Valhalla Legends Archive.
 

Non-wordwrapped (Rich)TextBox with no HScroll

Started by Spht, November 24, 2003, 02:57 PM

Previous topic - Next topic

Spht

Without creating my own RichEdit window through API, how would I go about modifying the properties of a (Rich)TextBox? The ideal result which I am trying to accomplish is a (Rich)TextBox which has no visible scroll bars, is multilined, and has automatic horizontal scrolling.

By default, the only way you can disable word wrapping on a (Rich)TextBox is by enabling a visible horizontal scrollbar.

I tried doing MyVar = GetWindowLong(.hWnd, GWL_STYLE), then adding ES_AUTOVSCROLL + ES_AUTOHSCROLL, then applying new flags with SetWindowLong, but it appears to have no effect.

Edit - By (Rich)TextBox, I mean that I will accept an answer using a RichTextBox or TextBox.

Thanks.

ObsidianWolf

This is a rough idea, but perhaps capture the amount of data perline and only show what would fit one line, having the rest dumped if you dont need it.  Easily done with terminal font.

Adron

You probably have to remove WS_VSCROLL from the style. It's also a bad idea to add styles using + (addition). If the window already has that style, you'll be removing it and adding some other style.


SetWindowLong .hWnd, GWL_STYLE, GetWindowLong(.hWnd, GWL_STYLE) And Not WS_VSCROLL Or ES_AUTOHSCROLL Or ES_AUTOVSCROLL

May need some parenthesis, not sure about VB operator precedence. It's also possible that it's too late to change the scroll bars using window style after the window has already been created.

Spht

Quote from: Adron on November 28, 2003, 05:15 AM
You probably have to remove WS_VSCROLL from the style. It's also a bad idea to add styles using + (addition). If the window already has that style, you'll be removing it and adding some other style.

I wasn't actually using +.

Quote from: Adron on November 28, 2003, 05:15 AM
SetWindowLong .hWnd, GWL_STYLE, GetWindowLong(.hWnd, GWL_STYLE) And Not WS_VSCROLL Or ES_AUTOHSCROLL Or ES_AUTOVSCROLL

Had no effect.

Quote from: Adron on November 28, 2003, 05:15 AM
It's also possible that it's too late to change the scroll bars using window style after the window has already been created.

Yeah, I'm beginning to think that too. I've tried many variations of modifying its styles but none work. The only solution may be to create the window myself at run-time -- I was hoping that I wouldn't have to do that though. Is there an alternative?

Spht

Adron introduced ShowScrollBar() to me. As a reference for anyone who is having this problem in the future, call ShowScrollBar(hWnd, wBar, bShow).

hWnd is the handle of your (Rich)TextBox.

wBar supplies the scrollbar to show/hide:
Const SB_VERT = 1
Const SB_HORZ = 0

bShow (true/false) toggles visibility of scroll bar.

Mesiah / haiseM

Damn, beat again by adron.. DAMN U STEALING ALL OF MY POSTS!!

jk jk, but yeah, i have a list of about every API Call and every constant used for richtextbox, theres some really neat things you can do with them (things i thought werent possible) its not such a bad thing to have layin around...

also, if u know how to put an image into an rtb, without using the clipboard, gogogogo share. :P
]HighBrow Innovations
Coming soon...

AIM Online Status: