Announcement

Collapse
No announcement yet.

How to ADD to Edit-control?

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

  • How to ADD to Edit-control?

    I'm working on a program that makes some time consuming calculations.
    During these calculations I would like some remarks and results to be
    written to a 'log-window'.
    How do you ADD text to an Edit-control?

    Regards
    Peter


    ------------------
    [email protected]
    www.dreammodel.dk

  • #2
    Use the %EM_REPLACESEL message, like:
    Code:
      txt = "New Line" & $CRLF
      CALL SendMessage(GetDlgItem(CBHNDL, %ID_TEXT), %EM_REPLACESEL, %TRUE, BYVAL STRPTR(txt))
    If you want to make sure the caret is at the end, use WM_GETTEXTLENGTH and EM_SETSEL, or
    EM_EXSETSEL, to place it in position. Otherwise, EM_REPLACESEL will paste the text at
    current position, which usually *is* at the end..

    BTW, does anyone know how use CONTROL SEND with a BYVAL STRPTR(txt) parameter?
    Could get that to work, but regular SendMessage always works..


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

    Comment


    • #3
      Borje --
      Control Send is already ByVal. So:
      Code:
      Dim Txt As String
      Txt = "semen"
      Control Send CbHndl, 101, %WM_SETTEXT, 0, StrPtr(Txt)
      ------------------
      E-MAIL: [email protected]

      Comment


      • #4
        Ah, thank you, Semen. Got a compiler error and didn't care to find
        out why, since I usually use SendMessage anyway. Nothing about this
        in PB help. Maybe should be added, since CONTROL SEND obviously
        isn't "exact" replacement for SendMessage and confusion therefore
        can arise when one looks in winapi32.hlp for how to set the parameters..

        Hm, forget it. When I look at it, the same approach, without BYVAL can
        be used with SendMessage too. Ah well..
        ------------------


        [This message has been edited by Borje Hagsten (edited March 19, 2001).]

        Comment

        Working...
        X