Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: PaiD on August 20, 2005, 09:58 AM

Title: [VB6] Add to RTB
Post by: PaiD on August 20, 2005, 09:58 AM
How would I go about appending text to a rich text box without the rich text box scrolling down to the new data but still being added to the bottom. I think it uses API but I am not sure. Any ideas?

PS. I have googled and looked @ pscode.com, no luck
Title: Re: [VB6] Add to RTB
Post by: Mangix on August 20, 2005, 10:46 AM
lol do a search on Grok's AddChat function. it's really nice :(

here's how you append it.

rtb.SelStart = Len(.Text)

Title: Re: [VB6] Add to RTB
Post by: l2k-Shadow on August 20, 2005, 11:14 AM
In the function, remove the .SelStart lines.
Title: Re: [VB6] Add to RTB
Post by: PaiD on August 20, 2005, 11:25 AM
Um I tried that. The problem Then is if the user has something hightlighted while the AddChat Function has been exucated it will append to the rich text box at the end of the hightlighted part.
Title: Re: [VB6] Add to RTB
Post by: Yegg on August 20, 2005, 12:28 PM
Are you sure you are using the AddChat subroutine properly?
Title: Re: [VB6] Add to RTB
Post by: PaiD on August 20, 2005, 02:03 PM
yes >.<
Title: Re: [VB6] Add to RTB
Post by: Soul Taker on August 20, 2005, 03:17 PM
Guys... could you actually READ his original post?  I believe many people around here have tried to make a RTB or RT add text to the bottom but not scroll, mostly unsucessfully.  I think Skywing had to make his own custom version of an RT or something... but don't quote me on that.
Title: Re: [VB6] Add to RTB
Post by: R.a.B.B.i.T on August 20, 2005, 04:02 PM
Add the text but don't set the pointer to the end of the text in the RTB then.  It's not hard, reather, it's extremely simple.
Title: Re: [VB6] Add to RTB
Post by: Yegg on August 20, 2005, 05:35 PM
Oh, I didn't read his question properly. I know that Python's wxPython library has a function, SetInsertionPoint(), it takes one parameter, if the value it receives is 0 then it keeps a text control (or RichTextBox) at the very beginning of all the text. And it will not scroll down. I know Visual Basic 6 has something like this, however I do not know what function or method it may be.
Title: Re: [VB6] Add to RTB
Post by: R.a.B.B.i.T on August 20, 2005, 06:40 PM
It's not using .SelStart(Len(.Text)) after adding <blarg>
Title: Re: [VB6] Add to RTB
Post by: Soul Taker on August 20, 2005, 06:56 PM
I have a feeling he only wants this functionality when the user is holding the scroll carat though.
Title: Re: [VB6] Add to RTB
Post by: UserLoser. on August 21, 2005, 12:47 AM
IIRC, you need to use WM_SETREDRAW, EM_GETSCROLLPOS, EM_SETSCROLLPOS, and InvalidateRect
Title: Re: [VB6] Add to RTB
Post by: PaiD on August 21, 2005, 01:11 AM
Thx Userloser
Title: Re: [VB6] Add to RTB
Post by: Soul Taker on August 21, 2005, 04:40 AM
Quote from: UserLoser on August 21, 2005, 12:47 AM
IIRC, you need to use WM_SETREDRAW, EM_GETSCROLLPOS, EM_SETSCROLLPOS, and InvalidateRect
That's the cheater way to do it though!
Title: Re: [VB6] Add to RTB
Post by: Mangix on August 21, 2005, 07:08 AM
the only thing that matters is the fact that it works.
Title: Re: [VB6] Add to RTB
Post by: Tazo on August 22, 2005, 09:11 PM
Spht added this to his bot, one of the reasons I like it so much  :-*
Thanks for the information justin, I've been searching for that for quite some time now  :P