PDA

View Full Version : Setting LableField or a TextField on listener



hananyariv
17 Feb 2011, 4:42 AM
Hello all,
i am trying to figure out how to setText or something like that on a Label or a text field -
This is for a information bar i want to spill out information about the user selection..

Does anyone know how to do that ? :)
Tnx

johnathanhebert
17 Feb 2011, 8:51 AM
If you have a textfield component... just add a listener to the object event that should trigger the text change... something like:



yourTextField.someEventHandler = function() {
this.setText('new text');
}

otherObject.on('someEvent', yourTextField.someEventHandler, yourTextField);


This will listen for an event on some object and call the someEventHandler when the event is fired... the 3rd argument will force someEventHandler to run in the scope of yourTextField, so that the "this" reference in your event handler refers to the textfield component