Announcement

Collapse
No announcement yet.

Multiline edit editing makes a mess

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

  • Multiline edit editing makes a mess

    This textbox (and others with different styles, but always multi-line)
    does not permit modification of existing text without making one unholy
    mess of it. Deleting a character in the middle of a line does work,
    as is proven by Control Get Text to t$, and immediately thereafter
    Control Set Text to t$, but this moves the cursor to position 0, and
    should in any event not be necessary. Just deleting a character seems
    to leave the previous position intact, with the new superimposed.
    What can be the problem?

    Code:
    t$=Trim$(InvNte$)
      Control Add TextBox, hDlg&, %CZivfTxt, t$, 16, 207, 192, 40, _
                                  %ES_MULTILINE, %WS_EX_CLIENTEDGE
      Control Send hDlg&, %CZivfTxt, %EM_LIMITTEXT, 200, 0
      Control Send hDlg&, %CZivfTxt, %WM_SETFONT, mnFont&, 1
      hCtl&=GetDlgItem (hDlg&, %CZivfTxt)
      TxtWndProc& = SetWindowLong (hCtl&, %GWL_WNDPROC, CodePtr(TxtSubProc))

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

  • #2
    Dieny

    You can always change the caret (insertion point) position of an edit control with:
    Code:
    CONTROL SEND hDlg, ID&, %EM_SETSEL, Pos, Pos
    where Pos is the desired position of the caret. You can also use this to set a selection within an
    edit control (by making the second Pos the end of the desired selection).
    You can then send messages to cut or paste the selection, to save resetting the entire string every
    time you wish to change it.

    In your final line of code, you appear to be sub-classing the edit control, but you don't show the
    sub-class procedure. Could there be a problem there?

    Regards, Simon


    [This message has been edited by Simon Morgan (edited June 22, 2001).]

    Comment

    Working...
    X