Results 1 to 3 of 3

Thread: Colour Weirdness.

  1. #1

    Thread Starter
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    Colour Weirdness.

    In my chat Program, it has the ability to send coloured messages.

    So when a user sends a Message it would look like this
    User1: Message, in black maybe....
    User2: A message in red

    At this stage all works well, but then ....

    User1: Oh my god, my username is now the colour that appeared above.


    Now this is definately not good. Anyways, I have little idea whats going on, so I've posted the full app on the forums, in the thread "Convert This App to VBA".

    Anyway, heres some sections that I think might be reasponsible

    VB Code:
    1. 'Found in the Toolbar, with messagelogtxt being the Sent Messages
    2. 'cdFont = CommonDialogBox
    3. 'messagetxt = Messages entered here.
    4.  
    5.  
    6. Case "Font"
    7. On Error Resume Next
    8. cdFont.Flags = cdlCFBoth
    9. cdFont.FontName = messageLogTXT.Font.Name
    10. cdFont.FontSize = messageLogTXT.Font.Size
    11. cdFont.FontBold = messageLogTXT.Font.Bold
    12. cdFont.FontItalic = messageLogTXT.Font.Italic
    13. cdFont.ShowFont
    14. With cdFont
    15. If .FontSize < 8 Then
    16.  
    17. messageTXT.Font.Name = .FontName
    18. messageTXT.Font.Size = .FontSize
    19. messageTXT.Font.Bold = .FontBold
    20. messageTXT.Font.Italic = .FontItalic
    21. Else
    22. Exit Sub
    23. End If
    24. End With
    25.  
    26.  
    27.  
    28.  
    29. Private Sub sendBTN_Click()
    30.     On Error Resume Next
    31.     Dim tempCommand As command
    32.    
    33. If Len(messageTXT.Text) > 300 Then
    34. Exit Sub
    35. End If
    36. If Len(messageTXT.Text) = 0 Then
    37. Exit Sub
    38. End If
    39.  
    40.     tempCommand.type = "MSG"
    41.     tempCommand.fromIP = getCurrentIP
    42.    
    43.     messageTXT.SelStart = 0
    44.     messageTXT.SelLength = Len(messageTXT.Text)
    45.     tempCommand.value = messageTXT.SelRTF
    46.     sendMessageToSelectedUsers tempCommand
    47.  
    48. '    For x = 0 To contactList.Count - 1
    49. '
    50. '        If contactList(x).sendTo Then
    51. '
    52. '            sendCommand_MessageSocket tempCommand, contactList(x).IP
    53. '
    54. '        End If
    55. '
    56. '    Next x
    57.  
    58.     messageTXT.Text = ""
    59.  
    60. End Sub



    Does anything there look abit dodge??



    Thanks in Advance.
    Don't Rate my posts.

  2. #2
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373
    Is there any other piece of code where the Font attributes are changed?

    I don't see there the part of the code that stores the previos settings of the Font (the one used to display de Name)

    Or maybe that's what is missing...the save Name displayed Font settings...you know what I mean?
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  3. #3
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    what you need to do is reset the color to black, since the color carries over from the RED text you made before. just do something like rTF.SelText = vbBlack, or whatever.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width