0

how to fire onClick event in the button using java code

asked 2011-12-09 13:29:36 +0800

saravanavel gravatar image saravanavel
54

how to fire onClick event in the button using java code

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2011-12-10 05:06:09 +0800

saravanavel gravatar image saravanavel
54

HAI BRILLIANCE...

THANK YOU SO MUCH..I HAVE REACHED TO SOLVE MY PROBLEM. USING YOUR IMMEDIATE REPLY. THANK ALOT BRILLIANCE.
SPECIAL THANK TO *gganassin , zippy , twiegand*

BY SARAVANAVEL

link publish delete flag offensive edit

answered 2011-12-09 15:36:07 +0800

twiegand gravatar image twiegand
1807 3

saravanavel,

Here is an example of what gganassin said:

<zk>
	<zscript>
		import org.zkoss.zk.ui.util.GenericForwardComposer;
			
		public class MyController extends GenericForwardComposer {
			Button button1;
			public void onClickButton2(Event event) {
				Events.sendEvent(button1, new Event("onClick", button1));
			}
		}
	</zscript>
	<window apply="MyController" style="padding: 15px;">
		<button id="button1" label="Say Hello">
			<attribute name="onClick">
				alert("Hello there!");
			</attribute>
		</button>
		<button label="Fire Event from Java" forward="onClick=onClickButton2()"/>
	</window>
</zk>

Hope that helps,

Todd

link publish delete flag offensive edit

answered 2011-12-09 14:25:32 +0800

zippy gravatar image zippy
504 2

updated 2011-12-09 14:26:24 +0800



...

this.button.addEventListener("onFocus", new EventListener() {

		public void onEvent(Event event) {
			foo();
		}
	});
	}
...

this.button.setFocus(true);

link publish delete flag offensive edit

answered 2011-12-09 14:21:44 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6
http://www.hybris.com/

Events.sendEvent(Events.ON_CLICK, yourButton, extraData);

is that what you meant? try to explain better your scenario otherwise :)

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: 2011-12-09 13:29:36 +0800

Seen: 484 times

Last updated: Dec 10 '11

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