text alignment

Discussion in 'Questions (Windows Mobile)' started by tremara1, Dec 26, 2008.

  1. tremara1

    tremara1 Active Member Licensed User

    Hi, and Happy Holidays to all. I was wondering if anyone had a solution to aligning text in textbox as columns. I have tried a couple of solutions I found in the forum. It seems the problem I have is the fact characters have different width. ( ooo is phsically wider than iii ) I have tried the richTextbox dll indenting but it seems to indent all elements that is if you set left indent to 0 for the first element then set left indent to 20 for the second element it indents both elements to 20. One solution I looked at saved the data to a formatted file and it looked perfect but when I applied this to display in a textbox.....same problem. I have a simple example of my problem.
    Tremara1 Australia

    Attached Files:

  2. agraham

    agraham Expert Licensed User

    Tab - Chr(9) - should work in TextBox and in RichTextDesktop. See the Tab method in RichTextDesktop help.
  3. taximania

    taximania Well-Known Member Licensed User

    This line confused me.
    CallSub("makeSpace",35 - StrLength("first"))
    The CallSub isn't needed is it ?
    makeSpace(35 - StrLength("first"))
    This works
    makeSpace(35 - 5)
    StrLength("first")) has a fixed value, 5

    Or even
    My reply doesn't help the OP much.
    But perhaps he was confused about calling subs as well.

    Using the same fixed value in both calls to makespace(30) in the example
    program provided does align the words correctly. But doesn't touch
    the font pitch.

    Is there a way to show text, in a fixed pitch, in a textbox ?
    Was probably a better question.

    Hic, Hey, come on it's xmas :)
  4. tremara1

    tremara1 Active Member Licensed User

    sorry about the confusion

    The reason I used a call to a sub was I want to use this to populate a textbox with formatted data from database fields of varying lengths of data.( ie firstname secondname). The length of the data will be highly variable. I think your right it is the pitch I need to control...any clues?

    thanks Tremara1
  5. taximania

    taximania Well-Known Member Licensed User

    Is this any help, Courier is a fixed pitch font :)

    fl is a FormLib object

    Sub Globals
    'Declare the global variables here.

    End Sub

    Sub App_Start
    Msgbox("standard text")
       textbox1.Text=textbox1.Text &  
    CRLF & "iiiiiii1"
       textbox1.Text=textbox1.Text &  
    "TextBox1","Courier New")
       textbox1.Text=textbox1.Text &  
    CRLF & "iiiiiii1"
       textbox1.Text=textbox1.Text &  
    End Sub
    Edit: Tested on device too ;-)
    Last edited: Dec 27, 2008
  6. tremara1

    tremara1 Active Member Licensed User

    done !!!!

    Thanks mate........it worked a treat.

  7. Colin123

    Colin123 New Member

    txtReport.Text = txtReport.Text & "test" & cTab & "qwe" & CRLF
    txtReport.Text = txtReport.Text & "t" & cTab & "asd" & CRLF
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice