• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Callbacks for edittext not working

Community Expert ,
Oct 25, 2020 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 ();

 

TOPICS
Scripting

Views

215

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
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 26, 2020 Oct 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

Votes

Translate

Translate
Community Expert ,
Oct 26, 2020 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

Votes

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
community guidelines
Community Expert ,
Oct 26, 2020 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...

Votes

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
community guidelines
Community Expert ,
Oct 27, 2020 Oct 27, 2020

Copy link to clipboard

Copied

Votes

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
community guidelines
Community Expert ,
Oct 27, 2020 Oct 27, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines