Announcement

Collapse
No announcement yet.

Displaying Records in a Multiline TextBox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mark pruitt
    replied
    Changing the font to Courier did the trick. Thanks again Chris, you've been resucing me alot lately.

    Leave a comment:


  • Chris Holbrook
    replied
    Either use tabs in the listbox and insert them into the string you are displaying, or use a non-PS font such as courier and pad with spaces.

    I can't guarantee that this code will work but it points the way.

    Code:
            local sz as asciz *64
    
            CASE %WM_INITDIALOG
    
                REDIM tbs(0 TO 2) AS LONG
                ' sets tabs, units are pixels/dialog units
                ' Note: negative values makes tabs stops right aligned,
                '      positive values makes them left aligned
                tbs(0) = -50 : tbs(1) = -100 : tbs(2) = -210
                CONTROL SEND hD, %IDC_LISTBOX1, %LB_SETTABSTOPS, UBOUND(tbs)+1, VARPTR(tbs(0))
          CASE something else
    
                    sz = "HELLO" + $TAB + "MOTHER" + $TAB + "WHERE IS SUPPER"
                    CONTROL SEND hD, %IDC_LISTBOX1, %lb_insertstring, 0, VARPTR(sz)

    Leave a comment:


  • mark pruitt
    started a topic Displaying Records in a Multiline TextBox

    Displaying Records in a Multiline TextBox

    I ran accross something I didn't realize today.

    I have a small app I'm writing. One portion has a multiline, read only textbox for display. There are only three fields for each record, Name, Registration #, and support email.

    To save the records from the dialog, I dim three fixed length strings

    DIM a AS STRING * 35
    DIM b AS STRING * 30
    DIM c AS STRING * 30

    Then I load the data into the variables, and save them as below:

    apprecord = a + "," + b + "," + c
    Then, I save apprecord.

    To display the records in the multiline text box, I dim 3 strings of the same lengths, use PARSE$ and the field number I want to pull the data from the record, and store them in a variable like this:

    FOR count = 1 to n (value of n obtained w/FILESCAN command)
    displayrecord$ = displayrecords + a + $TAB + b + $TAB + c + $CRLF
    NEXT n

    Then to display CONTROL SET TEXT blah, blah, displayrecord$

    What I've found is the display of the records isn't linear, even though the records are the same size. Here is what I mean; if my company name is 26 characters, the reg code 10, and the email whatever. Depending on the name of the company, and the length of the registration code, the records are not linearly displayed, even though the exact same number of characters are in each comparative field (assume a $TAB inserterted between the company and reg code, and the reg code and email:

    ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 [email protected]
    abcdefghijklmnopqrstuvwxyz 1234567890 [email protected]

    Is there a relatively simple way to overcome this? I've been scratching my head for a few hours, now I'm turning to the big dogs. Thanks in advance.
Working...
X