Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Chat style RTB help...


Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2003, 07:33 PM
MasamuneXGP's Avatar
MasamuneXGP MasamuneXGP is offline
Centurion
 
Join Date: Nov 2002
Location: NJ
Posts: 176
Default Chat style RTB help...


How would I go about making the text in an RichTextBox appear at the bottom instead of the top, like most chat programs?
__________________
You are just a puppet... you have no heart... and cannot feel any pain...
--Sephiroth
Reply With Quote
  #2  
Old 11-28-2003, 07:40 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

Code:
TextBoxName.SelStart = Len(TextBoxName.Text) TextBoxName.SelText = "Text to add" & vbCrLf
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #3  
Old 11-28-2003, 07:49 PM
MasamuneXGP's Avatar
MasamuneXGP MasamuneXGP is offline
Centurion
 
Join Date: Nov 2002
Location: NJ
Posts: 176
Default

No, not like that... I mean for the text to appear at the bottom of the WINDOW. Like you know when you sign on to mirc and join a channel, the text starts at the bottom and goes up as more text is entered? That's what I'm trying to do.
__________________
You are just a puppet... you have no heart... and cannot feel any pain...
--Sephiroth
Reply With Quote
  #4  
Old 11-28-2003, 07:56 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

Well the textbox used in mIRC is a custom control which Khaled created by himself. Without
resorting to that, I think you'll just have to fill the textbox with a lot of blank lines.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #5  
Old 11-28-2003, 07:58 PM
MasamuneXGP's Avatar
MasamuneXGP MasamuneXGP is offline
Centurion
 
Join Date: Nov 2002
Location: NJ
Posts: 176
Default

Yeah, I figured that, but isn't there a way to do it with the RTB's paragraph formatting or something? I mean, there are tons of chatting programs that do it that way, do you mean to tell me they ALL have custom controls?
__________________
You are just a puppet... you have no heart... and cannot feel any pain...
--Sephiroth
Reply With Quote
  #6  
Old 11-28-2003, 08:06 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

Well no, you're right. A quick flick through MSDN reveals the EM_SETPARAFORMAT message, which on a RichEdit 2.0 window, can also specify vertical spacing in the PARAFORMAT2 structure. This struct is not included within the API viewer which comes with VB, so you'll have to translate it from a C struct declaration.

Code:
typedef struct _paraformat { 
    UINT cbSize;  Long
    _WPAD _wPad1;
    DWORD dwMask; Long 
    WORD  wNumbering; Integer
    WORD  wReserved; Integer // redefined as wEffects in PARAFORMAT2
    LONG  dxStartIndent; Long
    LONG  dxRightIndent; Long
    LONG  dxOffset; Long
    WORD  wAlignment; Integer
    SHORT cTabCount; Integer
    LONG  rgxTabs[MAX_TAB_STOPS]; Long(MAX_TAB_STOPS - 1)
    LONG  dySpaceBefore; Long  // vertical spacing before para
    LONG  dySpaceAfter;   Long   // vertical spacing after para
    LONG  dyLineSpacing;  Long   // line spacing depending on Rule
    SHORT sStyle;      Integer      // style handle
    BYTE  bLineSpacingRule;  Byte // rule for line spacing (see tom.doc)
    BYTE  bCRC;       Byte       // reserved for CRC for rapid searching
    WORD  wShadingWeight;  Integer  // shading in hundredths of a per cent
    WORD  wShadingStyle;  Integer   // nibble 0: style, 1: cfpat, 2: cbpat
    WORD  wNumberingStart; Integer  // starting value for numbering
    WORD  wNumberingStyle; Integer  // alignment, roman/arabic, (), ), ., etc.
    WORD  wNumberingTab;  Integer   // space bet 1st indent and 1st-line text
    WORD  wBorderSpace;  Integer    // space between border and text (twips)
    WORD  wBorderWidth;  Integer    // border pen width (twips)
    WORD  wBorders;   Integer       // byte 0: bits specify which borders
                             // nibble 2: border style, 3: color index
} PARAFORMAT2;


Private Const EM_SETPARAFORMAT = (WM_USER + 71)
Private Const WM_USER = &H400

Private Const MAX_TAB_STOPS = 32
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #7  
Old 11-28-2003, 08:10 PM
MasamuneXGP's Avatar
MasamuneXGP MasamuneXGP is offline
Centurion
 
Join Date: Nov 2002
Location: NJ
Posts: 176
Default

Okay, um, seeing as I have absolutely zero C experience, would be so kind as to spell it out for this dimwit? ^^ Are you saying it's a SendMessage command?
__________________
You are just a puppet... you have no heart... and cannot feel any pain...
--Sephiroth
Reply With Quote
  #8  
Old 11-28-2003, 08:14 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

Yes, it would be something akin to:

Code:
Const PFM_SPACEBEFORE = &H40 Dim paraFormat As PARAFORMAT2 paraFormat.cbSize = Len(paraFormat) paraFormat.dwMask = PFM_SPACEBEFORE paraFormat.dySpaceBefore = 'Size, in twips, of space SendMessage theBox.hWnd, EM_SETPARAFORMAT, 0, paraFormat

SendMessage.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #9  
Old 11-28-2003, 08:16 PM
MasamuneXGP's Avatar
MasamuneXGP MasamuneXGP is offline
Centurion
 
Join Date: Nov 2002
Location: NJ
Posts: 176
Default

Okay, so I need PARAFORMAT2 type, but I have no idea how to translate it from that bunch of C code you pasted @_@

EDIT: thank you so much for the help thus far ^^
__________________
You are just a puppet... you have no heart... and cannot feel any pain...
--Sephiroth
Reply With Quote
  #10  
Old 11-28-2003, 08:18 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

I annotated the VB equivalents in bold next to each member. Ignore the _WPAD member.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #11  
Old 11-28-2003, 08:28 PM
MasamuneXGP's Avatar
MasamuneXGP MasamuneXGP is offline
Centurion
 
Join Date: Nov 2002
Location: NJ
Posts: 176
Default

Okay, so here's what I came out with:
Code:
Private Type PARAFORMAT2 cbSize As Long dwMask As Long wNumbering As Integer wReserved As Integer dxStartIndent As Long dxRightIndent As Long dxOffset As Long wAlignment As Integer cTabCount As Integer rgxTabs As Long dySpaceBefore As Long dySpaceAfter As Long dyLineSpacing As Long sStyle As Integer bLineSpacingRule As Byte bCRC As Byte wShadingWeight As Integer wShadingStyle As Integer wNumberingStart As Integer wNumberingStyle As Integer wNumberingTab As Integer wBorderSpace As Integer wBorderWidth As Integer wBorders As Integer End Type Private Const WM_USER = &H400 Private Const EM_SETPARAFORMAT = (WM_USER + 71) Private Const MAX_TAB_STOPS = 32 Private Const PFM_SPACEBEFORE = &H40 Public Sub InitRTB(RTB as RichTextBox) Dim paraFormat As PARAFORMAT2 paraFormat.cbSize = Len(paraFormat) paraFormat.dwMask = PFM_SPACEBEFORE paraFormat.dySpaceBefore = 10 SendMessage RTB.hWnd, EM_SETPARAFORMAT, 0, paraFormat End Sub
And.... it doesn't work ._.
What'd I do wrong?
__________________
You are just a puppet... you have no heart... and cannot feel any pain...
--Sephiroth
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proxy settings for chat application raiye Communications 0 11-25-2003 12:05 AM
create a private chat . angmoh Communications 3 10-27-2003 04:02 PM
Determining all Character Styles within a Paragraph Style bhartwig Word, PowerPoint, Outlook, and Other Office Products 1 10-16-2003 04:35 PM
Chat in VB VBBrazil Communications 2 04-13-2003 01:57 AM
Select the text of particular font style sreeni_2020 Word, PowerPoint, Outlook, and Other Office Products 0 12-24-2002 03:11 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->