I'm making a chat client lately. It's all going well. I've missed one thing on the way. When a message comes to you and there is more text than can fit without a scrollbar the text doesn't scroll down. I fixed this with scroll down action whenever a message comes. It all goes well but now there is a bug which I'm having problems with tackling. I have my chatbox, it's got some text in it and i click somewhere so the cursor is somewhere in the middle, not at the end of text. Now when a message arrives or a new line is added the text is added at the place of cursor. I was thinking of moving the cursor down by using the Go to line action and I put number of lines from scrolling as the value. But it doesn't seem to work. So does anyone have any solution. I would like quite a detailed solution.
Yeah, it kinda works. But then this strange glitch (?) comes along... When a message comes, a go to character number number of character, receive and add the message and then scroll down to the bottom. And then i set the focus on in message box (it gets turned off when i go to character number). But then instead of having just one empty line below it, it has 1 line and like half a line but it's not editable. Quite hard to explain :/
Tell me what you're doing to add new text to the box. It kind of sounds like you're doing it some odd way in the first place to be having all these problems.
Okay, I just had a quick screw around with the REO and it's wierd in some ways. It seems superfluous if all you're doing is using it to display messages, which the Edit object can do equally well.
Create an Edit object with Multiline, Read Only and Vertical Scroll attributes.
On Message
---Edit: Set text Edittext$(Edittext$( "Edit" )+[MESSAGE]+NewLine$)
---Edit: Scroll To End
That should do what you're trying to do with no problems at all. You can still select and copy text, but the cursor won't stay there to cause problems.
(Just for the sake of completeness, you might want to have an event that trims some of the leading characters from the edit box when the text in it starts to get really huge.)
The problem is, I'm using Rich Edit's Rich Format that enables me to change colours of messages. So I guess I will leave it as it is... Maybe I will improve it in future.