azkanan Posted December 31, 2012 Author Share Posted December 31, 2012 I'm trying to select and colour individual lines as they are printed into my RichTextBox, "GAME.menu_events". However, the selection keeps messing up.The text-box itself handles different lines printed out onto it, depending what has happened since the player hit explore, or wait, or any other actions - for example, the player might find an item, run into a person and feel exhausted. All three are completely different calls handled per turn.```dim last_text as stringlast_text = "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."GAME.menu_events.SelLength = Len(last_text)GAME.menu_events.SelStart = Len(GAME.menu_events) - Len(last_text)GAME.menu_events.SelColor = vbBlueGAME.menu_events.Font.Bold = TrueGAME.menu_events.text = GAME.menu_events.text & vbNewLine & "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."```Issue #1The entire text box is being bolded (therefore affected?).Issue #2The colour is not changing.Issue #3From debugging, the SelLength = 0, whilst the "Len(last_text)" is reading out 102 - what the hell, right? Link to comment Share on other sites More sharing options...
Mal Posted December 31, 2012 Share Posted December 31, 2012 ```GAME.menu_events.SelStart = Len(GAME.menu_events)GAME.menu_events.SelColor = vbBlueGAME.menu_events.Font.Bold = FalseGAME.menu_events.text = GAME.menu_events.text & vbNewLine & "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."GAME.menu_events.SelStart = Len(GAME.menu_events)GAME.menu_events.SelColor = vbBlueGAME.menu_events.Font.Bold = TrueGAME.menu_events.text = GAME.menu_events.text & vbNewLine & "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."```Try that. Link to comment Share on other sites More sharing options...
azkanan Posted December 31, 2012 Author Share Posted December 31, 2012 Values;SelStart = 2012Len(GAME.menu_events) = 2215==============================Everything is still getting bolded, and the colour still isn't working. ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) Link to comment Share on other sites More sharing options...
Mal Posted December 31, 2012 Share Posted December 31, 2012 ```dim last_text as stringlast_text = "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."GAME.menu_events.SelStart = Len(GAME.menu_events)GAME.menu_events.SelLength = Len(last_text)GAME.menu_events.SelColor = vbBlueGAME.menu_events.Font.Bold = TrueGAME.menu_events.text = GAME.menu_events.text & vbNewLine & "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."``` Link to comment Share on other sites More sharing options...
azkanan Posted December 31, 2012 Author Share Posted December 31, 2012 SelLength = 2"SelStart = 707", but "Len(GAME.menu_events) = 903"Everything goes bold.Nothing gets coloured. :| Link to comment Share on other sites More sharing options...
Stach Posted December 31, 2012 Share Posted December 31, 2012 ```Dim last_text As Stringlast_text = "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."GAME.menu_events.SelColor = vbBlackGAME.menu_events.SelBold = FalseGAME.menu_events.SelText = GAME.menu_events.SelText & vbNewLine & last_textGAME.menu_events.SelColor = vbBlueGAME.menu_events.SelBold = TrueGAME.menu_events.SelText = GAME.menu_events.SelText & vbNewLine & last_text```How about this? Link to comment Share on other sites More sharing options...
Matt Posted December 31, 2012 Share Posted December 31, 2012 ```Dim last_text As Stringlast_text = "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."GAME.menu_events.SelStart = Len(GAME.menu_events) - Len(GAME.menu_events)GAME.menu_events.SelLength = Len(last_text)GAME.menu_events.SelColor = vbBlueGAME.menu_events.Font.Bold = TrueGAME.menu_events.text = GAME.menu_events.text & vbNewLine & "You sure do hope to come across Mr Blue again - he's an amazing dancer in that technicolour dreamcoat."```Taels works as well, but I don't know what you're going for. Compare the two. Link to comment Share on other sites More sharing options...
azkanan Posted December 31, 2012 Author Share Posted December 31, 2012 Problem solved by Jowd;```Call AddText("TEXT HERE.", RGB(150, 0, 255))``````Public Sub AddText(ByVal Msg As String, ByVal Colour As Long, Optional IsBold As Boolean = False) Dim S As String S = vbNewLine & Msg GAME.menu_events.SelStart = Len(GAME.menu_events.Text) GAME.menu_events.SelColor = Colour If IsBold Then GAME.menu_events.SelBold = True Else GAME.menu_events.SelBold = False End If GAME.menu_events.SelText = S GAME.menu_events.SelStart = Len(GAME.menu_events.Text) - 1End Sub``` Link to comment Share on other sites More sharing options...
Mal Posted December 31, 2012 Share Posted December 31, 2012 > Problem solved by Jowd;> > ```> > Call AddText("TEXT HERE.", RGB(150, 0, 255))> > ```> ```> > Public Sub AddText(ByVal Msg As String, ByVal Colour As Long, Optional IsBold As Boolean = False)> > Dim S As String> > S = vbNewLine & Msg> > GAME.menu_events.SelStart = Len(GAME.menu_events.Text)> > GAME.menu_events.SelColor = Colour> > If IsBold Then> > GAME.menu_events.SelBold = True> > Else> > GAME.menu_events.SelBold = False> > End If> > GAME.menu_events.SelText = S> > GAME.menu_events.SelStart = Len(GAME.menu_events.Text) - 1> > End Sub> > ```Well, and I helped get the ball rolling. ;p Honestly glad they added an AppendText method and cleaned up selection's in .NET. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now