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.
    Thanks...
    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.
    Code:
    CallSub("makeSpace",35 - StrLength("first"))
    The CallSub isn't needed is it ?
    Code:
    makeSpace(35 - StrLength("first"))
    This works
    Code:
    makeSpace(35 - 5)
    StrLength("first")) has a fixed value, 5

    Or even
    Code:
    makeSpace(30)
    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
    Australia
     
  5. taximania

    taximania Well-Known Member Licensed User

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

    fl is a FormLib object

    Code:
    Sub Globals
       
    'Declare the global variables here.

    End Sub

    Sub App_Start
       Form1.Show
       fl.New1(
    "Form1",B4PObject(1))
       
    Msgbox("standard text")
       fl.ChangeFont(
    "TextBox1","Ariel")
       textbox1.Text=textbox1.Text &  
    CRLF & "iiiiiii1"
       textbox1.Text=textbox1.Text &  
    CRLF & "WWWWWWWW"
       
    Msgbox("Ariel")
       fl.ChangeFont(
    "TextBox1","Courier New")
       textbox1.Text=textbox1.Text &  
    CRLF & "iiiiiii1"
       textbox1.Text=textbox1.Text &  
    CRLF & "WWWWWWWW"
       
    Msgbox("Courier")
       
    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.

    Tremara1
    Australia
     
  7. Colin123

    Colin123 New Member

    txtReport.Text = txtReport.Text & "test" & cTab & "qwe" & CRLF
    txtReport.Text = txtReport.Text & "t" & cTab & "asd" & CRLF
     
Loading...
  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