texteditor #w.te, 10, 10, 280, 280
stylebits #w.te, 0, _ES_AUTOHSCROLL or _WS_HSCROLL, 0, 0
open "Wordwrap test" for window as #w
wait 
 
    sub EditWindow
       if EditOpen then
          call QuitFullEdit "#fulledit"
          if EditOpen then exit sub
       end if
       EditOpen = TRUE
       EditSave = FALSE
       Title$ = "Full Edit"
       WindowWidth = 595
       WindowHeight = 668 'DisplayHeight-100
       UpperLeftX=int((DisplayWidth - WindowWidth) / 2)
       UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    
       Menu #fulledit,"&File","&Save",EditSave,"&Exit",QuitEditFromMenu
       Menu #fulledit, "&Edit", "&Cut      Ctrl+X", Cut,_
        "C&opy    Ctrl+C", Copy, "&Paste   Ctrl+V", Paste,_
        "&Undo    Ctrl+Z", Undo,"C&lear",Clear,|,_
        "&Select All",SelectAll
        open Title$ for window as #fulledit
        print #fulledit, "trapclose QuitFullEdit"
        print #fulledit, "resizehandler EditResize"
 
        hT=CreateTextEdit(hwnd(#fulledit), 1, 1, WindowWidth-10, WindowHeight-10)
        call SetFocus hT
 
        call SetWindowText hT,cellval$
        hFont=CreateFont("courier new",16)
        ret = SendMessageLong(hT,_WM_SETFONT,hFont,1)
    end sub
   Function CreateTextEdit(hW, x, y, w, h)
        style = _WS_CHILDWINDOW OR _WS_BORDER _
        OR _WS_VISIBLE or _ES_MULTILINE
' ---------  tried putting _ES_AUTOHSCROLL or _WS_HSCROLL here, 
'             but did not work
        hInst=GetWindowLong(hW, _GWL_HINSTANCE)
    
        calldll #user32, "CreateWindowExA",_
            0 as long,"EDIT" as ptr,_
            "" as ptr, style as long,_
            x as long,y as long,w as long,h as long,_
            hW as long, 0 as long, hInst as ulong,_
            0 as long, CreateTextEdit as ulong
    end function