The Daily Click ::. Forums ::. Klik Coding Help ::. Rich Edit Object and scrolling
 

Post Reply  Post Oekaki 
 

Posted By Message

Plooscva



Registered
  25/10/2006
Points
  149

Has Donated, Thank You!
10th February, 2007 at 09:26:40 -

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.

Plooscva

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
10th February, 2007 at 10:10:17 -

edit:
hang on, I want to check something

edit:
Yeah, kind of wierd how it handles the cursor even when in read-only mode. Anyway.

(Rich Edit Object) has the input focus
---goto character number GetNChars("Rich Edit Object")

Try that.

Image Edited by the Author.

 
n/a

Plooscva



Registered
  25/10/2006
Points
  149

Has Donated, Thank You!
10th February, 2007 at 11:18:01 -

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 :/

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
10th February, 2007 at 18:34:42 -

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.

 
n/a

Plooscva



Registered
  25/10/2006
Points
  149

Has Donated, Thank You!
14th February, 2007 at 13:27:28 -

Well, seeing as you're interested in helping I will get a screenshot showing it exactly.

http://img444.imageshack.us/img444/4053/pcproblemdg6.png

First image shows what happens to the scrolling when I get a message and the text fills up the Rich Edit Object.

Second image shows what should happen and what happens after clicking in the Rich Edit Object and scrolling down.

This is what I do for the events.

On Message
- (Rich Edit) Go to charcter number GetNChars
- Set text to "Message"

Everything works fine but it results in strange scrolling shown in first image.

I know this doesn't do much bad and isn't very necessary, but it is worth trying to make it better.

Plooscva

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th February, 2007 at 21:04:05 -

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.)

 
n/a

Plooscva



Registered
  25/10/2006
Points
  149

Has Donated, Thank You!
15th February, 2007 at 12:23:30 -

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.

Great thanks for trying to help.

Plooscva

 
n/a
   

Post Reply



 



Advertisement

Worth A Click