-
Well everyone...I have been in a VB slump the last 2 days and have had to ask many ?'s....so here's another:
I have RTB that only views 7 lines at a time. The 4th line (middle) is changed to a font size larger and a different color to specify that is the current line in use. I had to cut the width of my RTB by about 1.5 inches and now the longer lines (only a few per file) wordwrap the excess to the next line.
How can I make it just truncate the line or add a scrollbar.
This box is used to scroll XY coordinate files that are usaully 500+ lines.
Thanks again to everyone that has been answering my questions. Without you all my forehead would be numb, my monitor broken (possibly my machine), and my sanity out the window...well if I have any of that left! ;-)
-
Uhh... That's funny. I can't make my Rich TextBox control wordwrap even when I want it to. How the hell did you do it?
This should add the scrollbar:
RTB.ScrollBars = 1 (Horizontal).
I don't think Rich TextBox controls have a WordWrap propery, but don't quote me on that.
I suppose you could also knock the font size down a few notches, or make it Arial Narrow or something.
-Zero the Inestimable.
-
Well this is interesting. You can't make the RTB wordwrap and I can't get it to stop. I am using the following code to build a file and then display it:
FileHead = "{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}}"
TxtCol="{\colortbl\red0\green0\blue0;\red128\green0\blue0;}"
TxtCol2 = "{\colortbl\red0\green0\blue0;}"
PreTxt1 = "\deflang1033\pard\plain\f0\fs18\cf0 "
PreTxt2 = "\par \plain\f0\fs20\cf1 "
PreTxt3 = "\par \plain\f0\fs16\cf0 "
PostTxt = "\plain\f0\fs17"
FileEnd = "\par }"
'Add RTF codes to text for correct display
CurLine(1) = PreTxt1 & line(1): CurLine(2) = PreTxt3 & line(2)
CurLine(3) = PreTxt3 & line(3): CurLine(4) = PreTxt2 & line(4)
CurLine(5) = PreTxt3 & line(5): CurLine(6) = PreTxt3 & line(6)
CurLine(7) = PreTxt3 & line(7) & PostTxt
'Print compiled info. to RTF
Open App.path & "\temp2.dat" For Output As #FileX2
Print #1, FileHead
Print #1, TxtCol
For i = 1 To 7
Print #1, CurLine(i)
Next
Print #1, FileEnd
Close #1
'Advance line up one and open slot for new value
RTBDisp.LoadFile App.path & "\temp2.dat", rtfRTF
For ii = 1 To 6
line(ii) = line(ii + 1)
Next
And when it displays it in the RTB the lines that are longer than the box wordwrap. Funky...huh???
Thanks for the info on the scrollbars!
-
Aha! The problem is not in ourselves, but the control itself.
My code uses a simple "Text = Text +" arrangment:
ConsoleScreen.Text = ConsoleScreen.Text + Chr(10) + "Unable to comply: Unknown Command."
Speaker.filename = App.Path + "\sounds\eva unable to comply.wav"
Speaker.Play
Command.Text = ""
Using this, it does not wrap the text.
However, if I load a file with the LoadFile method, it automatically wraps it.
(?)
So try dropping the file contents into a variable and then doing this:
RTBDisp.Text = RTBDisp.Text + chr(10) + Var
The chr(10) is a an Enter character and will make it move to the next line. Otherwise it'll all be on one line, but not wordwrapped. Which kinda defeats the purpose...
-Z