Highlighted

Callbacks for edittext not working

Advocate ,
Oct 25, 2020

Copy link to clipboard

Copied

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 ();

 

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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

TOPICS
Scripting

Views

32

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Callbacks for edittext not working

Advocate ,
Oct 25, 2020

Copy link to clipboard

Copied

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 ();

 

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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

TOPICS
Scripting

Views

33

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 25, 2020 0
Adobe Community Professional ,
Oct 26, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 26, 2020 0
Advocate ,
Oct 26, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 26, 2020 0
Advocate ,
Oct 27, 2020

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 0
K.Daube LATEST
Advocate ,
Oct 27, 2020

Copy link to clipboard

Copied

After all I do not implement something special:

  • to get the text into the clipboard, the user justs needs to type CTRL+a and CTRL+c
  • to cleaar the area CTRL+a and DEL are sufficient.

After all these are common actions.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 0