home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ETKSIM.ZIP / ESIMPLE.E < prev    next >
Text File  |  1992-02-15  |  2KB  |  50 lines

  1. -- This event procedure is called when an new edit window is opened.
  2. -- arg(1) contains the string that was passed to EPM_EditWindowCreate
  3. -- in the create structure as 'filename'.
  4. defmain
  5.    'xcom e 'arg(1)  -- assume arg(1) is a file and edit it
  6.    .autosave     = 0
  7.    keys mykeys
  8.    -- Show window, EPM toolkit windows are initialy hidden
  9.    -- post the EPM_EDIT_SHOW message
  10.    call windowmessage(0, getpminfo(5),
  11.                       5385,
  12.                       upcase(arg(1))<>'OFF', -- 0 if OFF, else 1
  13.                       0)
  14.  
  15. -- Key definitions :    EDLLSAMP.E defines a small set of active key...
  16. -- Look at STDKEYS.E provided in EMACROS.FLS for other key definitions.
  17.  
  18. defkeys mykeys new
  19.  
  20. def space    =keyin ' '
  21. def backspace=rubout
  22. def enter    =insert;down;.col=1
  23. def home     =begin_line
  24. def ins      =insert_toggle
  25. def left     =left
  26. def pgup     =page_up
  27. def pgdn     =page_down
  28. def right    =right
  29. def left     =left
  30. def up       =up
  31. def down     =down
  32. def del=delete_char
  33.  
  34. -- Commands that are used by EDLLSAMP
  35. -- Look at STDCMDS.E provided in EMACROS.FLS for other cmd definitions.
  36.  
  37. -- Close the edit window by posting it a PM destroy message.
  38. defc close=
  39.     /* WM_CLOSE */
  40.     WindowMessage( 0, gethwnd(5), 41, 0, 0)
  41.  
  42. -- Returns the edit window handle, as a 4-digit decimal string.
  43. defproc gethwnd(w)
  44.    hwnd    = atol(getpminfo(w))   /* get edit window handle           */
  45.                                   /* convert string to string pointer */
  46.                                   /* interchange upper two bytes with */
  47.                                   /* lower two bytes. (flip words)    */
  48.  
  49.    return substr(hwnd,3,2) || substr(hwnd,1,2)
  50.