|
-
Aug 20th, 2000, 02:31 AM
#1
Thread Starter
So Unbanned
This is what happens:
say this is the chat log:
-
Me: hey
you: sup?
me: Nothing much, you?
you: same
-
me: sounds fun
you: indeed...
me: well my textbox glitches
Ok, that's all nice, say the height is only 4 lines high
but when I add text and I have the selstart = len(text) it'll flash to the top of the box so I can very briefly see the top 4 lines then it goes to the bottom. I havn't experienced this with other programs, aol, etc.
I need something to make the scroll bar stay in the same place.
-
Aug 20th, 2000, 05:07 AM
#2
The reason for this flicker is that you are changing the Text property. When you do that the caret is moved to the first position in the TextBox. Use the SelText property instead:
Code:
With RichTextBox1
.SelStart = Len(.Text)
.SelText = vbCrLf & "The New Text To Add"
End With
Good luck!
-
Aug 21st, 2000, 05:43 PM
#3
Thread Starter
So Unbanned
Your code worked great except that the SelText blocks some characters. Chr$(0) for example, if anything comes after it it won't appear.
Anyway to fix this?
-
Aug 21st, 2000, 06:33 PM
#4
The reason chr$(0) is blocked is because in C and C++ a null char means end of string.
Why would you like to send a null char after all?
-
Aug 21st, 2000, 06:36 PM
#5
Thread Starter
So Unbanned
It has a coloring code like IRC where the first few characters format the text, bold, italic, colors, etc.
-
Aug 21st, 2000, 06:40 PM
#6
Thread Starter
So Unbanned
Further more...
That's why I switched to a RTB instead of a regular textbox.
-
Aug 21st, 2000, 07:14 PM
#7
Use the SelColor, SelBold, SelItalic, SelUnderline and so on to set these properties before you use the SelText property to set the text.
Code:
With RichTextBox1
.SelStart = Len(.Text)
.SelColor = vbRed 'or whatever
.SelBold = True
.SelText = "Here comes some text in red and bold font"
End With
Good luck!
-
Aug 21st, 2000, 11:42 PM
#8
Addicted Member
I'm not sure if this will work, i havn't tried it on a rtbox, but it got rid of glitches in a flexgrid control.
before you assign the new text to the rich text box can you just set the visible property of the box to false, and then set it to true after you add the text?
maybe maybe who knows...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|