Thread

Rich Text Box Margin (Bots)

Rich Text Box Margin // Bots

1  |  

dion

Jul 1, 2002, 11:47pm
How do i make a margin for the chat messages? I am using spaces now so it's
not very good. It's all a little off. A margin would work a lot better so
the amount of space the characters in the name take up doesn't effect how
well lined up all the chat messages are. LOL, that was confusing.

I am trying to make a Rich Text Box act the way the chatbox in ActiveWorlds
behaves. Everything is pretty simple except for the large space inbetween
the name and the message. I'll show you what I've got and you tell me how to
fix it. How's that? ;-)

Private Sub SDK_EventChat()
AwChat.SelBold = False
AwChat.SelItalic = False
AwChat.SelColor = vbBlack
AwChat.SelText = SDK.AwAvatarName & ":"
For X = 1 To 17 - Len(SDK.AwAvatarName)
AwChat.SelText = " "
Next X
AwChat.SelText = SDK.AwChatMessage & vbCrLf
End Sub

young phalpha

Jul 2, 2002, 2:00am
Well, I don't program VB but I looked at the VB documentation and I guess you might try
AwChat.SelIndent and setting it to something around .5 to 2.0, gotta love documentation :D Keep
in mind with Rich Text controls the indent property can is skipped if you do something like
Name:<tabchr>Message - the tabchr is ASCII code 9, hope this might help, if not my attempting to
make since of the VB docs without knowledge of VB has not been successful :)

- YP

[View Quote] I am trying to make a Rich Text Box act the way the chatbox in ActiveWorlds
behaves. Everything is pretty simple except for the large space inbetween
the name and the message. I'll show you what I've got and you tell me how to
fix it. How's that? ;-)

Private Sub SDK_EventChat()
AwChat.SelBold = False
AwChat.SelItalic = False
AwChat.SelColor = vbBlack
AwChat.SelText = SDK.AwAvatarName & ":"
For X = 1 To 17 - Len(SDK.AwAvatarName)
AwChat.SelText = " "
Next X
AwChat.SelText = SDK.AwChatMessage & vbCrLf
End Sub

dion

Jul 2, 2002, 2:35am
Alright, I guess that worked. LOL, I dunno why I didn't think of that :-P
The only thing else I needed to add was to put one tab for names with more
than 10 characters and two for names with less than 10 characters. :-)

Thanks :)

[View Quote]

young phalpha

Jul 2, 2002, 4:02am
the margin specifies how big the tab is

- YP

[View Quote] Thanks :)

[View Quote]

grimble

Jul 2, 2002, 11:05am
Unless you're using a fixed font (e.g. courier new) in the RT box, you
really want to be working out the width of the text in pixels rather than
the number if characters ("WWWWW" is much wider that "IIIII").

You can do this using the TextWidth property of either the form of an
invisible picture box (with the same font settings as the RT Box).

You can find it in the VB local help or (sorry if the link gets split in the
post) at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vb98/html/v
bmthtextwidth.asp

Grims

[View Quote]

grimble

Jul 2, 2002, 11:09am
For a chat window, maybe the SelHangingIndent property would be more
suitable (also indents wrapped lines of a "paragraph").

Grims

[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2022. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn