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

Make edittext active when radiobutton clicked

Engaged ,
Jan 10, 2019 Jan 10, 2019

I have a complex panel, and am trying to jump straight to an edittext when a radiobutton is clicked.

Greatly simplified:

     box.groupButton.onClick = function ( ) { box.groupEdittext.active = true };

box.groupEdittext reports as active when tested in the long version of the above function, but neither shows as having the focus nor has the cursor placed in it.

I've also tried:

     box.groupButton.addEventListener ( 'click', function ( ) { box.groupEdittext.active = true } );

with the same (non) effect.

Elsewhere:

     box.groupEdittext1.onActivate = function ( ) { box.groupEdittext2.active = true };

(which is the closest to an onClick event as one can get with edittext) works as expected (albeit not a lot of use), putting the focus on box.groupEdittext2and placing the cursor in it.

Changing the radiobutton to a checkbox effects no change in behaviour.

Any ideas how to achieve this simple jump very much welcomed, or is it impractical/impossible?  Or am I too stupid to see the blindingly simple error/solution?

TOPICS
Actions and scripting
1.1K
Translate
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
Adobe
People's Champ ,
Jan 10, 2019 Jan 10, 2019

Grimbaldus 

      box.groupButton.onClick = function ( ) { box.groupEdittext.active = true };

In CS6, everything works great. In CC (2018), as always, nothing works.
Use this method

var d = new Window("dialog")

var r1 = d.add("radiobutton", undefined, " R1");         

var r2 = d.add("radiobutton", undefined, " R2");         

var dummy = d.add("statictext", undefined, "");         

var t1 = d.add("edittext", undefined, " 11111111111111");         

r1.onClick = function() { dummy.active = true; t1.active = true;  }

d.show()

Translate
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
Engaged ,
Jan 10, 2019 Jan 10, 2019

r-bin​, thanks, but the existing full code of the box.groupButton.onClick function already makes a statictext active.  So no joy.

PS: I should have said, CC2019 (20.0.1) on Win10.  I'll check tomorrow (UK) on Mojave and revert if that is any different.

Translate
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
People's Champ ,
Jan 10, 2019 Jan 10, 2019

Understood nothing.

So does it work for you or not? What exactly is the problem?

Translate
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
Engaged ,
Jan 11, 2019 Jan 11, 2019

Duh!

I said it was a complex panel, with a lot of code.  In testing this morning, I observed that a statictext box was being changed under certain infrequently occurring circumstances.  Detailed investigation then revealed two variable names which differed only in the classic "Zero/Oh".

Fixed that and the a/m problem vanished.

Thanks to all for thinking through the issue, and especially to r-bin​.

Translate
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
Advocate ,
Jan 11, 2019 Jan 11, 2019

Grimbaldus

I did not understand what you want exactly

if you can be more specific

can not you post the source code?

Translate
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
Engaged ,
Jan 11, 2019 Jan 11, 2019
LATEST

geppettol66959005​​, apologies if my question was not clear enough.  I thought it was simply put.

And no, I was not going to post the entire source code, it's tens of thousands of lines long, in hundreds of interrelated functions.

Regardless, I have solved the issue.

Translate
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
LEGEND ,
Jan 11, 2019 Jan 11, 2019

Me too, so like yestarday I couldn't understand what that guy wants: Detect clipping path when pasting imagine

Translate
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
Engaged ,
Jan 11, 2019 Jan 11, 2019

Kukurykus​, apologies if my question was not clear enough.  I thought it was simply put.

Regardless, I have solved the issue.

Translate
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