-- L_entry.exw  -- a scrollable sle with a size limit.

include win32lib.ew
without warning -- ( integer shift ) is not used in onKeySle1

constant
-- EM_LIMITTEXT   = #C5, -- now in win32lib.ew

  MyWin  = create( Window, "..enter a phrase up to 55 char..", 
                  0, 0, 0, 460, 80, {#CC0000} ),  -- nothing but [x]
  Label1 = create( RText, "..then hit ENTER:", MyWin, 5, 5, 110, 20, 0 ), 
  Sle1   = create( EditText, "", MyWin, 115, 3, 100, 22, 0 ), 
  Label2 = create( LText, "", MyWin, 5, 27, 450, 22, 0 )

procedure onOpen_MyWin(  integer self,  integer event,  sequence params  )
  integer i
  -- set for maximum 55 characters. using EM_LIMITTEXT(#C5).
  i=sendMessage( Sle1, EM_LIMITTEXT, 55, 0 )
end procedure

-- the ENTER key signals line completion.
procedure onKey_Sle1(  integer self,  integer event,  sequence params  )
-- transfer line to Label2 in main window.
  integer key = params[1]
  if key=13 then setText( Label2, getText( Sle1 ) ) end if
end procedure

setHandler(  MyWin,  w32HOpen,  routine_id( "onOpen_MyWin" )  )
setHandler(  Sle1,  w32HKeyDown,  routine_id( "onKey_Sle1" )  )

WinMain( MyWin, Normal )

-- end --
