Skip to main content
K.Daube
Community Expert
Community Expert
October 25, 2020
Answered

Callbacks for edittext not working

  • October 25, 2020
  • 1 reply
  • 418 views

Dear all,

I want to do something with the content of an edittext area - namely for onClick and for onDoubleClick. As you might know, these events are not triggered in edittext - but for example in a listbox. Hence I try to set up specific event handlers. But nothing happens when clicking/double clicking on the edit field.

→ What is missed here?

/*  on(Double)Click.jsx ====== UTF-8 ====================================
              check possibilites to act on an edittext click/doubleclick
Comment       There is no onClick (and no onDoubleClick) for edittext
              Hence appropriate event listeners must be defined
              See JavaScript Tools Guide for the eventName in 
              controlObj.addEventListener (eventName, handler[, capturePhase]);
Reference     https://stackoverflow.com/questions/39416360/set-focus-of-edit-text-in-extendscript
History       2020-10-25
*/ ; // =========================================================================

main = function () {
var win;

  win = new Window ("dialog", "on(Double)click", undefined, undefined);
  win.eField    = win.add ("edittext", undefined, "Text in field", undefined);
  win.btnCancel = win.add ("button", undefined, "Cancel", undefined);
  
//win.eField.active = true;
  win.eField.addEventListener ("click (detail = 1)", hClick);  //, true);
  win.eField.addEventListener ("click (detail = 2)", hDClick); //, true);

  win.show ();
} //--- end main

hClick = function () {
  alert ("Click into edittext");
  $.writeln ("Click into edittext");
} //--- end hClick

hDClick = function () {
  alert ("DoubleClick into edittext");
  $.writeln ("DoubleClick into edittext");
} //--- end hDClick

main ();

 

This topic has been closed for replies.
Correct answer frameexpert

Hi Klaus, I don't have time to look at this now, but you may want to post this to the InDesign forum. There are some seasoned ScriptUI users on there that have helped me from time-to-time with these kinds of issues. They are not specific to FrameMaker and the InDesign community is much larger than the FrameMaker community.

 

Here is a useful, free resource for the ScriptUI object:

https://creativepro.com/files/kahrel/indesign/scriptui.html

1 reply

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
October 26, 2020

Hi Klaus, I don't have time to look at this now, but you may want to post this to the InDesign forum. There are some seasoned ScriptUI users on there that have helped me from time-to-time with these kinds of issues. They are not specific to FrameMaker and the InDesign community is much larger than the FrameMaker community.

 

Here is a useful, free resource for the ScriptUI object:

https://creativepro.com/files/kahrel/indesign/scriptui.html

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthor
Community Expert
October 26, 2020

Thank you Rick for the tip (ID-forum). The pdf from Petr Kahrel is my main source four ScriptUI problems...