-- a simple addressbook example, by Wolf/Jan./99

include win32lib.ew
without warning

constant
  MyWin   = create(Window, "AddressBook", 0, 0, 0, 230, 370, 0),
  List1   = create(SortedList, "", MyWin, 10, 10, 200, 60, 0),    
  Label1  = create(LText, "", MyWin, 10, 69, 210, 18, 0),
  Label2  = create(RText, "Last:", MyWin, 10, 92, 65, 20, 0),
  Sle1    = create(EditText, "", MyWin, 80, 89, 130, 22, 0),
  Label3  = create(RText, "First:", MyWin, 10, 117, 65, 20, 0),
  Sle2    = create(EditText, "", MyWin, 80, 114, 130, 22, 0),
  Label4  = create(RText, "Address:", MyWin, 10, 142, 65, 20, 0),
  Sle3    = create(EditText, "", MyWin, 80, 139, 130, 22, 0),
  Label5  = create(RText, "Street:", MyWin, 10, 167, 65, 20, 0),
  Sle4    = create(EditText, "", MyWin, 80, 164, 130, 22, 0),
  Label6  = create(RText, "City:", MyWin, 10, 192, 65, 20, 0),
  Sle5    = create(EditText, "", MyWin, 80, 189, 130, 22, 0),
  Label7  = create(RText, "State:", MyWin, 10, 217, 65, 20, 0),
  Sle6    = create(EditText, "", MyWin, 80, 214, 80, 22, 0),
  Label8  = create(RText, "Zip:", MyWin, 10, 242, 65, 20, 0),
  Sle7    = create(EditText, "", MyWin, 80, 239, 80, 22, 0),
  Label9  = create(RText, "Phone:", MyWin, 10, 267, 65, 20, 0),
  Sle8    = create(EditText, "", MyWin, 80, 264, 130, 22, 0),

  MenuTop   = create(Menu, "&File", MyWin, 0, 0, 0, 0, 0),
  MenuSave  = create(MenuItem, "&Save", MenuTop, 0, 0, 0, 0, 0),
  MenuExit  = create(MenuItem, "E&xit", MenuTop, 0, 0, 0, 0, 0),
  MenuDo    = create(Menu, "&Item", MyWin, 0, 0, 0, 0, 0),
  MenuNew   = create(MenuItem, "&New", MenuDo, 0, 0, 0, 0, 0),
  MenuAdd   = create(MenuItem, "&Add", MenuDo, 0, 0, 0, 0, 0),
  MenuDelete= create(MenuItem, "&Delete", MenuDo, 0, 0, 0, 0, 0),

  btnNew  = create(PushButton, "New", MyWin, 10, 290, 40, 25, 0),
  btnAdd  = create(PushButton, "Add", MyWin, 55, 290, 40, 25, 0),
  btnSave = create(PushButton, "Save", MyWin, 100, 290, 50, 25, 0),
  btnDel  = create(PushButton, "Delete", MyWin, 155, 290, 60, 25, 0)
    
-- set the background color
setWindowBackColor( MyWin, rgb(0,255,127) )

atom Handle -- declare variable we use for file handling.
object line, line2, e_entry
integer listlen -- length of list


procedure onMenu_Exit( integer self, integer event, sequence params )
    closeWindow(MyWin)
end procedure

setHandler( btnNew, w32HClick, routine_id("onClick_btnNew") )
setHandler( btnAdd, w32HClick, routine_id("onClick_btnAdd") )
setHandler( btnSave, w32HClick, routine_id("onClick_btnSave") )
setHandler( btnDel, w32HClick, routine_id("onClick_btnDel") )
setHandler( MenuExit, w32HClick, routine_id("onMenu_Exit") )
setHandler( MenuNew, w32HClick, routine_id("onClick_btnNew") )
setHandler( MenuAdd, w32HClick, routine_id("onClick_btnAdd") )
setHandler( MenuSave, w32HClick, routine_id("onClick_btnSave") )
setHandler( MenuDelete, w32HClick, routine_id("onClick_btnDel") )

WinMain(MyWin,Normal)

-- end --
