Announcement

Collapse
No announcement yet.

Parse or Print textbox text with wordwrap

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

  • Parse or Print textbox text with wordwrap

    My program has a large textbox for user to enter comments, and the
    style uses wordwrap. Great for user, but when I try to print, there are
    no $CRLF's to use with a Parse$ routine? How does one print on paper
    the exact image in textbox without being able to parse?

    Thanks

    Brent

  • #2
    Ask the control:
    Send EM_GETLINECOUNT and EM_GETLINE messages.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Found in help file:
      Code:
      CONTROL SEND hDlg, %IDT_TEXT, %EM_GETLINECOUNT, 0,0 TO mResult
      CONTROL SEND hDlg, %IDT_TEXT, %EM_FMTLINES, %TRUE, 0 TO mResult   'LINE NBR, 0
      The first message returns the correct number of lines.
      The Second message does NOT insert "$cr+$cr+$lf" like it is
      supposed to do? Stumped!

      Comment


      • #4
        Works Now!
        Soft return constant:
        $Softret = CHR$(13)+CHR$(13)+CHR$(10)
        In Sub Print Routine:
        Code:
           
          UpdateToDialog hDlg, N
          CONTROL SEND hDlg, %IDT_TEXT, %EM_FMTLINES, %TRUE, 0
          CONTROL GET TEXT hDlg, %IDT_TEXT TO RC6$
             FOR i& = 1 TO 2  
              IF i& = 1 THEN
               RC6A$ =  RTRIM$(PARSE$(RC6$, $Softret, i&))
              ELSEIF i& = 2 THEN
               RC6B$ =  RTRIM$(PARSE$(RC6$, $Softret, i&))
        	END IF
        OK, now what if user inadvertently presses the <enter> key?
        Then routine will not parse correctely?

        Comment


        • #5
          Seems to work correctly if I remove style %ES_WANTRETURN.
          I use this style for textbox control:
          Code:
           %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _
           OR %ES_WANTRETURN OR %WS_TABSTOP
          Instead of removing style %ES_WANTRETURN, use: REPLACE, before printing.
          ' Allows use of <enter> key so user can start a new line without having to space to end.
          $Softret = CHR$(13)+CHR$(13)+CHR$(10)
          REPLACE $CR+$LF WITH $SoftRet IN RC6$
          Last edited by BRENT GARDNER; 22 Feb 2008, 06:30 AM. Reason: update

          Comment


          • #6
            >Seems to work correctly if I remove style %ES_WANTRETURN.

            I get that a lot: Things work correctly when you read and obey the documentation.
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Ouch! Boy, I felt that one all the way over here in New Jersey (the real home of the NFL World Champion Giants, by the way).
              It's a pretty day. I hope you enjoy it.

              Gösta

              JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
              LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

              Comment

              Working...
              X