Announcement

Collapse
No announcement yet.

Navigating a Rich Text Edit Box

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

  • Bob Houle
    replied
    Mike,

    Nope... but I found a report solution in Alpha Five,
    so it worked out for me in the end, but someday I'll re-tackle
    the PB method.

    Regards,
    --Bob

    ------------------

    Leave a comment:


  • Mike Doty
    replied
    Bob,
    Did you ever get an RTF mail merge to work?

    ------------------

    Leave a comment:


  • Bob Houle
    replied
    Thanks Steve, that's kind of what I'm looking for.

    If I save the rtf as a string, do a few "insertions"
    will the rtf maintain it's formatting?

    The reason I ask is:
    The user needs to be able to design, as well as format the letter's
    'body', plus indicate where they need to place the database "name",
    "salutation" fields, etc.

    I thought the user might type in an unusual key combination that I would locate
    such as ascii # 135
    e.g. ‡Salutation‡ ‡Title‡ ‡Last_Name‡

    Once these "flags" are visibly in the RTF file, the user would press the
    "Print Letter"button which would:

    a) Create the file
    b) Replace the above flags with actual client information
    e.g. IF ‡Salutation‡ THEN Rec.Salutation

    c) Save this new rtf file
    d) Print it
    e) Repeat the above for each client in the 'filtered' database

    If this can be made to work, it would save users a "huge" amount of time for
    anyone trying to send out nicely formatted merge letters.

    Thanks again,
    --Bob

    ------------------

    Leave a comment:


  • Steve Hutchesson
    replied
    Bob,

    The makeup of a rich edit control does not allow access to the internal
    storage method so you either have to use the built in search messages
    or retrieve the contents of the control into a string buffer buffer and
    then use INSTR to locate the text you are after.

    My own preference is to use the selection capacity to select the entire
    content of the control and put it in a string buffer. You will need to get
    the swing of the messages for a rich edit control to do this.

    Use this type of code to select all of the text.

    Code:
      
          LOCAL Cr as CHARRANGE
    
        ' -------------------
        ' Set full text range
        ' -------------------
          Cr.cpMin = 0
          Cr.cpMax = GetWindowTextLength(hEdit) + 1
    
        ' ----------------
        ' Allocate Buffer
        ' ----------------
          Buffer$ = space$(Cr.cpMax)
    
        ' -------------------------------------
        ' Set the selection to full text range
        ' -------------------------------------
          SendMessage hEdit,%EM_EXSETSEL,0,ByVal VarPtr(Cr)
    
        ' -----------------------------------------------
        ' Read the contents of the control into a buffer
        ' -----------------------------------------------
          SendMessage hEdit,%EM_GETSELTEXT,0,ByVal StrPtr(Buffer$)
    You will need to include the INCLUDE file for the rich edit control to get the
    messages as well.

    Regards & Good luck with it.

    [email protected]

    ------------------

    Leave a comment:


  • Bob Houle
    started a topic Navigating a Rich Text Edit Box

    Navigating a Rich Text Edit Box

    Not wishing to use Word 97 or WordPerfect to do "mail merges",
    I prefer to do this in PowerBASIC.

    Is it possible to go to a certain location "inside" a rich text
    edit box?

    What I'd like to do is:
    Retrieve names, etc. from a customer database,
    Insert this info "into" a RTF document
    (at the location I choose inside this rtf file)
    Then print this document.

    I started playing with Don Dickinson's RTFPrint.bas file found in POFFS,
    and have it working well, except for the above.

    Does anyone have any experience in this area?
    Any help would be greatly appreciated.

    Regards,
    --Bob

    ------------------
Working...
X