0

get onChanging value in java

asked 2007-07-04 12:12:00 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4395845

By: tommasofin

I want to get the the value of a textbox at the onChanging event. I've extended the textbox component in this way:

public class TextChange extends Textbox {

public void onChanging(Event event) {

}
}

After some debug I've saw that in the "event" object there is the private variable _val that contains the value entered, but there isn't the getter for this variable.

How can I do?

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2007-07-04 12:21:03 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4395855

By: jumperchen

Use the getTarget method to get the component.
For example,

((Textbox)event.getTarget()).getValue;

/Jumper

link publish delete flag offensive edit

answered 2007-07-04 12:38:47 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4395891

By: tommasofin

I've just try this but doesn't work. If I call:

((Textbox)event.getTarget()).getValue;

is the same thing of:

this.getValue();

The value of the textbox is the old value at the onChanging event (page 92 of zkdevguide). The fresh value is only inside the event object.

Any other suggestion?

link publish delete flag offensive edit

answered 2007-07-04 13:00:36 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4395933

By: tommasofin

I've found.
The problem was because I used the Event class an not InputEvent class. In this way it works:

public class TextChange extends Textbox {

public void onChanging(InputEvent event) {

System.out.println((String)event.getValue());

}
}

link publish delete flag offensive edit

answered 2008-03-12 17:22:50 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4832648

By: erickmelo

I'm having the same problem reported in this Thread.
I want implements a suggestion combobox: I tried this code:

combo.addEventListener("onChanging", new EventListener() {
public void onEvent(Event event) throws Exception {
System.out.println("value"+combo.getValue());

}

});

But I dont' get the Combobox typed value... It returns :" value, value, value".
For each letter typed I get a printed line, but combo.getValue() doesn't return any value.

Is it a bug or am I using some thing wrong?


link publish delete flag offensive edit

answered 2008-03-13 00:46:12 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4833555

By: waterbottle

Hi,
Did you read above discussion already?

public void onChanging(InputEvent event) {

System.out.println((String)event.getValue());

}

/Dennis

link publish delete flag offensive edit

answered 2012-07-18 09:28:19 +0800

lccp gravatar image lccp
3

thanks tommasofin
just a add, the getValue() method return a String, there's no need to cast it.

public void onChanging(InputEvent event) {

System.out.println(event.getValue());

}

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-07-04 12:12:00 +0800

Seen: 380 times

Last updated: Jul 18 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More