|
-
Nov 10th, 2000, 01:33 AM
#1
Thread Starter
Addicted Member
This is my code to cause my chat window to scroll down one line to be ready for the next SendData.
It is supposed to resemble your standard run of the mill chat window, but I continue to fail in successful implementing an AUTO SCROLLING feature.
I would sure appreciate it if you could help me out...
Here is the error I am getting:
"Runtime error #28, Out of stack space"
When I hit Debug I am brought to this Sub:
Code:
Private Sub Chat_Change()
Chat.Text = Chat.Text & vbNewLine
'See if auto-scroll is desired
If chkScroll.Value = 1 Then
'Start the Auto Scroll
Chat.SelStart = Len(Chat.Text)
End If
End Sub
The highlighted offending line is:
Chat.Text = Chat.Text & vbNewLine
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
-
Nov 10th, 2000, 01:36 AM
#2
Fanatic Member
Out of stack space means, that there are two much functions/subs called at the same time.
This line:
Code:
Chat.SelStart = Len(Chat.Text)
Will raise another Chat_Change event. So, it results in endless-looping.
-
Nov 10th, 2000, 02:01 AM
#3
Declare a boolean var, wrap the entire code in the sub in an if statement that only enters the if when the boolean var is true. In the first line of the if statement, set the boolean to True, and set it to false at the end of the code inside the if. That way, when the change event is called, it only executes your code if it is not already changing.
I'd write some code, but I'm in a rush. Sorry
- gaffa
-
Nov 10th, 2000, 02:06 AM
#4
Thread Starter
Addicted Member
Thanks for the reply...
Thanks guys, much appreciated...
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
-
Nov 10th, 2000, 02:15 AM
#5
Thread Starter
Addicted Member
Gaffa
Gaffa is this what you mean....if so, it is failing to auto scroll.
Code:
Private Sub Chat_Change()
Dim TextChange As Boolean
If TextChange = True Then
Chat.Text = Chat.Text & vbNewLine
'Auto Scroll
Chat.SelStart = Len(Chat.Text)
TextChange = False
End If
End Sub
This auto scrolling and making the text box automatically move down one line is very nerve racking, (That and I'm on the tired side):-)
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
-
Nov 10th, 2000, 08:02 AM
#6
Thread Starter
Addicted Member
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
-
Nov 10th, 2000, 09:20 AM
#7
Fanatic Member
Just remove the line: Chat.Text = Chat.Text & vbNewLine ...
The rest of the code will allow for the autoscroll like a dos window/telnet window/mirc, etc. I've done this before and it works. Basically, you want it so the text scrolls up like you're constantly at the last line (not a blank line, unless someone sends an enter)? Then the code that oetje gave you will work perfectly.
-
Nov 10th, 2000, 09:31 AM
#8
Thread Starter
Addicted Member
Perfect, I appreciate the tip.
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
-
Nov 10th, 2000, 09:34 AM
#9
Fanatic Member
I predict a problem with your code (I might be wrong).
The boolean should be Static...
Code:
Private Sub Chat_Change()
Static TextChange as Boolean
If TextChange = True Then
Chat.Text = Chat.Text & vbNewLine
'Auto Scroll
Chat.SelStart = Len(Chat.Text)
TextChange = False
End If
End Sub
Or Global...
Code:
Option Explicit
Private TextChange as Boolean
Private Sub Chat_Change()
If TextChange = True Then
Chat.Text = Chat.Text & vbNewLine
'Auto Scroll
Chat.SelStart = Len(Chat.Text)
TextChange = False
End If
End Sub
ExcalibursZone is also right. However, if you take the line
Code:
Chat.Text = Chat.Text & vbNewLine
out, you will have to add a line break before adding the next person's chat text.
r0ach™
Don't forget to rate the post
-
Nov 10th, 2000, 10:31 AM
#10
Thread Starter
Addicted Member
And naturally, I want to have the code force a line break.
I appreciate your reply.
I appreciate all of your time and effort,
Daniel Christie
VB 5 and 6 Enterprise Editions,
Html, Java scipt, Vb script,
& etc...
http://www.qwcd.com
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
|