Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: CrAz3D on March 09, 2004, 01:30 PM

Title: AddChat Going Funky
Post by: CrAz3D on March 09, 2004, 01:30 PM
http://crazed.no-ip.com/images/addchat.jpg (http://crazed.no-ip.com/images/addchat.jpg)
Private Sub mnuNPCon_Click()
NPUsername = frmNP.txtUsername.text
NPPassword = frmNP.txtPassword.text
NPIP = frmNP.txtIP.text

tcp.AddChat vbYellow, "NP Server Connecting to: " & NPIP
NP.Close
NP.Connect NPIP, 1337
End Sub

Public Sub AddChat(ParamArray saElements() As Variant)

If frmOptions.chkLockChat = vbChecked Then
   Exit Sub
Else
   Dim i As Integer
   If Len(Form1.RTB.text) > 50000 Then
       With Form1.RTB
           .Visible = False
           .SelStart = 0
           .SelLength = InStr(1, .text, vbLf, vbTextCompare)
           .SelText = vbNullString
           .Visible = True
       End With
   End If
   With Form1.RTB
       .SelStart = Len(.text)
       .SelLength = 0
       .SelColor = vbWhite
       .SelText = "[" & Time & "] "
       .SelStart = Len(.text)
   End With
   For i = LBound(saElements) To UBound(saElements) Step 2
       With Form1.RTB
           .SelStart = Len(.text)
           .SelLength = 0
           .SelColor = saElements(i)
           .SelText = saElements(i + 1) & Left$(vbCrLf, -2 * CLng((i + 1) = UBound(saElements)))
           .SelStart = Len(.text)
       End With
   Next i
End If
End Sub



You can see for yourself what it is doing.  It does it USUALLY when I use the KeyBoard shortcut I set to mnuNPCon, which is ctrl
+E.  Is that an option for richtexts to change the allignment?


EDIT: Well, I hit post too soon. ctrl+E is an alignment for RichText, is there a way to disable that is my new question.
Title: Re:AddChat Going Funky
Post by: SNiFFeR on March 09, 2004, 02:35 PM
Link doesn't work :(
Title: Re:AddChat Going Funky
Post by: CrAz3D on March 09, 2004, 02:36 PM
hmm... should, does for me...
http://exiled-realm.net/craz3d/images/addchat.jpg (http://exiled-realm.net/craz3d/images/addchat.jpg)
Try that instead.
Title: Re:AddChat Going Funky
Post by: Stealth on March 09, 2004, 05:41 PM
Try debug.printing what you send to AddChat.

What is most probably causing the error is something wrong in one of the calls you're making to AddChat. (I haven't looked at the code but it's hard to mess AddChat up.) Figure out what's supposed to be displayed.
Title: Re:AddChat Going Funky
Post by: CrAz3D on March 09, 2004, 08:54 PM
It was the ctrl+E, it's a shortcut for RichTxt
Title: Re:AddChat Going Funky
Post by: Newby on March 10, 2004, 08:47 AM
Quote from: CrAz3D on March 09, 2004, 08:54 PM
It was the ctrl+E, it's a shortcut for RichTxt

IIRC, CTRL + E moves it to center.

CTRL + R moves it to right :)
Title: Re:AddChat Going Funky
Post by: CrAz3D on March 10, 2004, 09:31 AM
Yah, I found that would when I put ANOTHER shortcut to ctrl+R, lol.

HOW GAY!
Title: Re:AddChat Going Funky
Post by: Adron on March 10, 2004, 11:36 AM
A solution might be not to allow focus to stay on the rich text box?
Title: Re:AddChat Going Funky
Post by: o.OV on March 10, 2004, 08:39 PM
Quote from: Adron on March 10, 2004, 11:36 AM
A solution might be not to allow focus to stay on the rich text box?

That is similar to how I handle my rtb for an old chat bot.

To copy text ..
I set it up to copy selected text and then lose focus when mouse button is released.

Add-On:
craz3d..
what are these shortcuts for anyways..
the ones you are adding I mean.
Title: Re:AddChat Going Funky
Post by: CrAz3D on March 10, 2004, 08:59 PM
Just menu items, Connect & Disconnect. (BNET & Newby's Server)