locked
Tab Spacing in TextWindow RRS feed

  • Question

  • Is there anyway to change the tab spacing in the textwindow.  It is currently set at 8. Meaning if I am at position 1 and if I issue a tab it will move over to position 9.  Then 8 more would be position 17.  Here's a snippet that will show what it tabs to:

    TextWindow.WriteLine("Ja"+Text.GetCharacter(9)+"me" +Text.GetCharacter(9)+"s")
    TextWindow.WriteLine("12345678901234567890")
    TextWindow.CursorLeft=8
    TextWindow.Read()

    I would like to be able to change the tab spacing to whatever I need, but I don't see a way to do that.

    JR
    Friday, May 8, 2009 12:14 PM
    Answerer

Answers

  • Rushworks,

    Thanks for your reply.  I did put my request into the features and bug fixes for V0.5.  Also, thanks for the code snippet.  I'll have to play around and see if I can get it do what I am trying to do.  The text that I have is actually being read in from a file.  The tab's are already embedded in the file.  Currently what happens is sometimes a column of the text is longer which takes it past where the next column of text should start which shifts the whole line too far to the right.  I think with your code I'll be able to set the tab positions wider and then output the text line a character at a time.  When I read in a tab character then move the cursor to the tab position.

    It would be alot easier if Small Basic let us set the tab width.

    Thanks,

    JR
     
    Saturday, May 9, 2009 12:59 AM
    Answerer

All replies

  • You should post your request in Features and bug fixes for v0.5
    http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/0d9ecfa5-3f64-4f91-b651-f1c01ab24921

    Here's a possible solution in Small Basic

    Sub Tab
      TabOffset = Math.Remainder(TextWindow.CursorLeft, TabSize)
      If (TextWindow.CursorLeft + TabSize - TabOffset >= 80) Then
        TextWindow.WriteLine("")
      Else
        TextWindow.CursorLeft = TextWindow.CursorLeft + TabSize - TabOffset
      Endif
    EndSub

    TabSize = 4

    TextWindow.Write("Ja")
    Tab()
    TextWindow.Write("me")
    Tab()
    TextWindow.Write("s")

    TextWindow.WriteLine("")
    TextWindow.WriteLine("12345678901234567890")

    TabSize = 6

    TextWindow.Write("Ja")
    Tab()
    TextWindow.Write("me")
    Tab()
    TextWindow.Write("s")

    TextWindow.WriteLine("")
    TextWindow.WriteLine("")

    Friday, May 8, 2009 6:29 PM
  • Rushworks,

    Thanks for your reply.  I did put my request into the features and bug fixes for V0.5.  Also, thanks for the code snippet.  I'll have to play around and see if I can get it do what I am trying to do.  The text that I have is actually being read in from a file.  The tab's are already embedded in the file.  Currently what happens is sometimes a column of the text is longer which takes it past where the next column of text should start which shifts the whole line too far to the right.  I think with your code I'll be able to set the tab positions wider and then output the text line a character at a time.  When I read in a tab character then move the cursor to the tab position.

    It would be alot easier if Small Basic let us set the tab width.

    Thanks,

    JR
     
    Saturday, May 9, 2009 12:59 AM
    Answerer