edittext and keyboard "keydown" event

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

tyr

edittext and keyboard "keydown" event

Post by tyr »

Hi everyone,

I'm not sure I understand how can I make my statictext has the same value as edittext while I typing? With keydown event its being late by 1 key:
Am I using a wrong event?



Thanks!

Code: Select allvar w = new Window ("dialog");
var e1 = w.add ("edittext", [0,0,30,20], "1");
e1.active = true
var s1 = w.add ("statictext", [0,0,30,20], e1.text)

e1.addEventListener("keydown", function () {s1.text = e1.text})

w.show()
Mikaeru

edittext and keyboard "keydown" event

Post by Mikaeru »

You can define the "onChanging" event-handling callback, available from CS2:

Code: Select allvar w = new Window ("dialog");
var e1 = w.add ("edittext", [0,0,30,20], "1");
e1.active = true
var s1 = w.add ("statictext", [0,0,30,20], e1.text)

e1.onChanging = function () {s1.text = e1.text}

w.show()

HTH...
tyr

edittext and keyboard "keydown" event

Post by tyr »

Yeah! Many thanks Mikaeru!