kijato

Adobe Rader, Javascript, MouseEvent

Dec 25th, 2021 (edited)
1,238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html?rhtocid=_6_1_8_23_1_1#t=Acro12_MasterBook%2FJS_API_AcroJS%2FField_methods.htm%23XREF_37472_setAction
  3. */
  4. app.addMenuItem({
  5.     cParent: "SignMenu",
  6.     cName: "mouse",
  7.     cUser: "mouse",
  8.     cExec: "Mouse()",
  9. });
  10. var Mouse = app.trustedFunction( function ()
  11. {
  12.     app.beginPriv();
  13.     console.show();
  14.     doIt( dialog, this );
  15.     app.endPriv();
  16. });
  17. function doIt(dialog,doc)
  18. {
  19.     dialog.doc = doc;
  20.     console.println(doc);
  21.     doc.addField("z","text",0,this.getPageBox());
  22.   z = this.getField("z");
  23.   z.borderColor = color.green;
  24.   //z.set
  25.   doc.addField("a","text",0,[10,10,150,150]);
  26.     doc.addField("b","text",0,[250,250,400,400]);
  27.     a = this.getField("a");
  28.     a.setAction( "MouseEnter", "nP()" );
  29.     a.setAction( "MouseExit", "nP()" );
  30.     a.setAction( "MouseUp", "rField()" );
  31.     a.borderColor = color.red;
  32.     a.lineWidth = 1;
  33.   a.fillColor = color.yellow;
  34.     b = this.getField("b");
  35.     b.value = event.value;
  36.     b.borderColor = color.blue;
  37.     b.lineWidth = 3;
  38.     //nP(doc);
  39.     //rField();
  40. }
  41.  
  42. nP = app.trustedFunction ( function(doc)
  43. {
  44.     app.beginPriv();
  45.     console.println(event.source +" "+event.target);
  46.     console.println(this.getField("a"));
  47.     this.borderWidth=5;
  48.     app.endPriv();
  49. });
  50.  
  51. rField = app.trustedFunction ( function(doc)
  52. {
  53.     app.beginPriv();
  54.   console.println("_"+this+"_");
  55.     //this.removeField("b");
  56.     app.endPriv();
  57. });
  58.  
  59.  
  60. myTrustedGetGlobal = app.trustedFunction ( function()
  61. {
  62.     app.beginPriv();
  63.     var y = global.x;
  64.     return y
  65.     app.endPriv();
  66. });
  67. myTrustedSetGlobal = app.trustedFunction ( function(value)
  68. {
  69.     app.beginPriv();
  70.     global.x=value;
  71.     app.endPriv();
  72. });
Add Comment
Please, Sign In to add comment