Valhalla Legends Forums Archive | Visual Basic Programming | rtb Issue

AuthorMessageTime
Lenny
Whenever I minimize my richtextbox and a change occurs while it is minimized (such as an rtbAdd), all the text is pushed up for some reason when I restore the window.

February 8, 2004, 2:48 AM
Lobo.id
[code]rtbChat.Find rtbChat.Text, 0, Len(rtbChat.Text)[/code]

Put that in your form resize sub.
February 8, 2004, 3:30 AM
Lenny
I had not realized there was a Find function for the rtb, but after experimenting with the code you gave me and some other ideas of my own, the richtextbox still pushes all the text beyond the visible area when I restore...

I suppose this just a small problem, and in some cases a good feature.
February 8, 2004, 4:53 AM
Lobo.id
Did you place the code at the end of your resize code?
February 8, 2004, 4:55 AM
Lenny
[quote author=Lobo.iD link=board=31;threadid=5161;start=0#msg43058 date=1076216127]
Did you place the code at the end of your resize code?
[/quote]

Yes I did, right above the End Sub
February 8, 2004, 4:57 AM
Lobo.id
hmm, wierd sorry my code didn't help, it's what I always used. Good luck on finding a solution.
February 8, 2004, 5:14 AM
Lenny
Did you have the same problem?
February 8, 2004, 5:28 AM
Grok
Show some code.
February 8, 2004, 5:42 AM
Lobo.id
No I don't have the same problem. Do what grok said show us some code, we will be able to better aid your problem.
February 8, 2004, 5:56 AM
Lenny
[code]
'Vertical
rtbChat.Height = 0.63 * Me.ScaleHeight

'Horizontal
rtbChat.Width = Me.ScaleWidth - 2955
[/code]

This is the form resize for my rtb...
the .63 is the scale relative to the actual form (.63 : 1)
February 8, 2004, 6:24 AM
Grok
Oh boy! Two whole lines. Someone with ESP will have to help you.
February 8, 2004, 6:41 AM
Newby
At the end of your function.

Put something like

rtb.SetStart = Len(rtb.Text)

That should help =|
February 8, 2004, 6:51 AM
Lenny
[code]
Public Sub rtbAdd(ParamArray Elements() As Variant)
rtbTimeStamp "[" & Format(Time, "hh:mm:ss") & "] ", vbWhite
Dim i As Integer
For i = LBound(Elements) To UBound(Elements) Step 2
With rtbChat
.SelStart = Len(.text)
.SelLength = 0
.SelColor = Elements(i + 1)
.SelText = Elements(i)
.SelStart = Len(.text)
End With
Next i
End Sub
Public Sub rtbTimeStamp(ByVal txtOne As String, ByVal clrOne As Long)
With rtbChat
.SelStart = Len(.text)
.SelLength = 0
.SelColor = clrOne
.SelText = txtOne
End With
End Sub
[/code]
My rtbAdd function...
February 8, 2004, 7:56 AM
Lobo.id
The rtbAdd code should not result in the problem your haveing, post your resize code, also set a breakpoint on the code I gave you to put in, see if it is ever executed.
February 8, 2004, 3:45 PM
Lenny
The resize code I posted earlier is the only code I have for my rtb right now...

[code]
rtbChat.Height = 0.63 * Me.ScaleHeight
[/code]

When I disable this, the rtb works normally as it should, perhaps you can't use this kind of syntax for setting height...Its unfortunate, I thought I had found an easier way to deal with resizing controls through the use of ratios
February 10, 2004, 2:55 AM
Lobo.id
I don't know if this will help any but...

[code]
Const Padding As Integer = 15 * 15
rtbChat.Height = Me.ScaleHeight - Padding
[/code]

It's subtracting 15 pixels(I Believe).

Hope that helps.
February 10, 2004, 3:34 AM
Lenny
Actually I solved my problem by Exiting Sub whenever it was a minimize, perhaps the window became so small on a minimize that the text was being shifted to the top...
February 11, 2004, 8:08 PM
Lobo.id
Glad you got it figured out. Sorry if I was not much of help.
February 11, 2004, 11:24 PM

Search