home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / eeedit22.zip / enhanced.zip / Plugin.api < prev    next >
Text File  |  2001-04-15  |  3KB  |  103 lines

  1. /****************************************/
  2. /* Sample API's for use in plugins      */
  3. /*                                      */
  4. /* Many other calls to the editor can   */
  5. /* be found in the "addon.ext" code     */
  6. /* templates                            */
  7. /****************************************/
  8.  
  9. /****************************************/
  10. /* Variables you can use                */
  11. /****************************************/
  12. Window = Is the Control ID for the editor itself
  13. Target = Is the Control ID for the edit window (MLE)
  14. IniDir = Location of the editor (no trailing backslash)
  15.  
  16.  
  17. /****************************************/
  18. /* Turn the red "Working" light ON/OFF  */
  19. /****************************************/
  20. Call VpSetItemValue EEEmainwin,1019,rdledon
  21. Call VpSetItemValue EEEmainwin,1019,rdledoff
  22.  
  23.  
  24. /****************************************/
  25. /* Messagebox API's                     */
  26. /* "response" will hold the user action */
  27. /****************************************/
  28. response=VpMessageBox(window,'title','message')
  29. response=VpMessageBox(window,'title','message','YESNO')
  30. response=VpMessageBox(window,'title','message','YESNOCNCL')
  31. response=VpMessageBox(window,'title','message','RETRY')
  32. response=VpMessageBox(window,'title','message','IGNORE')
  33.  
  34.  
  35. /****************************************/
  36. /* Make the editor load a file          */
  37. /****************************************/
  38. Call Openfile FileName
  39.  
  40.  
  41. /****************************************/
  42. /* API's for the edit window            */
  43. /****************************************/
  44.  
  45. /* Get first character position Target (MLE) */
  46. FirstChar=VpItem(window,Target,'SENDMSG','0x01d6')
  47.  
  48. /* Get selection range Target (MLE) */
  49. PARSE VALUE VpGetIndex(window,Target) with First Last
  50.  
  51. /* Get text in range Target (MLE) */
  52. /* needs the previous call to get the "First" & "Last" variables */
  53. SelectedText = VpGetItemValue(window,Target,First,Last)
  54.  
  55. /* Get all text in Target (MLE) */
  56. Document = VpGetItemValue(window,Target)
  57.  
  58. /* Select a range the Target (MLE) */
  59. CALL VpSelect window,Target,First,Last
  60.  
  61. /* Select all items Target (MLE) */
  62. CALL VpSelect window,Target,'ALL',1
  63.  
  64. /* Add item at current location Target (MLE) */
  65. CALL VpAddItem window, Target, 'CURRENT', value
  66.  
  67. /* Set item value Target (MLE)         */
  68. /* Replaces all text in MLE with value */
  69. CALL VpSetItemValue window,Target,value
  70.  
  71. /* Highlight the text from "First" to "Last" */
  72. Call VpSelect window,Target,First,Last
  73.  
  74. /* Reset undo flag in the (MLE) */
  75. CALL VpItem window,Target,'SENDMSG','0x01cf'
  76.  
  77. /* Enable/Disable painting of the Target (MLE) */
  78. CALL VpItem window,Target,'DISABLEPAINT'
  79. CALL VpItem window,Target,'ENABLEPAINT'
  80.  
  81. /* Enable/Disable Stdio window      */
  82. /* Helps when debugging your plugin */
  83. CALL VpWindow window,'ENABLESTDIO'
  84. CALL VpWindow window,'DISABLESTDIO'
  85.  
  86. /* Set window title */
  87. CALL VpWindow window,"SETTITLE",value
  88.  
  89. /* Set InfoLine text */
  90. CALL VpWindow window, "SETINFOLINE", value
  91.  
  92. /* Cut selected text to clipboard */
  93. CALL VpItem window,ITEMID,'SENDMSG','0x01d8' 
  94.  
  95. /* Copy selected text to clipboard */
  96. CALL VpItem window,ITEMID,'SENDMSG','0x01d9' 
  97.  
  98. /* Paste text from clipboard */
  99. CALL VpItem window,ITEMID,'SENDMSG','0x01da' 
  100.  
  101. /* Delete selected text */
  102. CALL VpItem window,ITEMID,'SENDMSG','0x01db' 
  103.