0

which event was fired when window.doModal ?

asked 2009-04-09 07:26:10 +0800

evpole gravatar image evpole
481 2

Hi, everybody!
I need to do something when window.doModal() was called,which event should i listen to ?
thanks for any help!

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2009-04-09 11:08:22 +0800

hideokidd gravatar image hideokidd
750 1 2

hi,

There seems no event can be used when searching API and event list,
http://www.zkoss.org/javadoc/3.6.0/zul/org/zkoss/zul/api/Window.html
http://docs.zkoss.org/wiki/Component_Events

but I find a very poor workaround, which doesn't prove to be effcient...

<zk>
</zscript>
<window id="win" title="test window" border="normal">
<attribute name="onMove">
System.out.println("move now");
</attribute>
<button label="close" onClick="win.setVisible(false)"/>
</window>
<button label="doModal" onClick="win.doModal()"/>
</zk>

hmmmmm......may somebody knows the real answer.

link publish delete flag offensive edit

answered 2009-04-09 13:22:15 +0800

james gravatar image james
255 2

I'm not sure the real answer to that, but maybe my thoughts may be of some use.
How are you calling the doModal() function?
Perhaps when you call that function (where ever it is in your code) you can also trigger another function...
This way you wouldn't use an event listener, but would simply do whatever it is you need to do.
That may be another possible workaround.
That is basically what I do.

link publish delete flag offensive edit

answered 2009-04-09 14:24:55 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-04-09 14:28:28 +0800

yes, i'm doing like james too.

1. onCreate$myWindow(){}
- initializing all stuff that are overhanded per params.
- set the ButtonController.
- check the rights for a user so do a setVisible() for all comps
and than called the doShowDialog()
2. doShowDialog(){}
- bind the components to data and at end i call the myWindow.doModal()

Stephan

link publish delete flag offensive edit

answered 2009-04-10 02:07:46 +0800

evpole gravatar image evpole
481 2

Thank you very much,hideokidd,james,and terrytornado !

Listen to onMove may be the proper way as far as current time.
do it after call window.doModal() also could finish the task.but seems not so good for this situation:

A window called win_A has it's own controller, it's behavor was controlled by this controller.
This window was used as a macro component.
There are lots of places where the component win_A was used. so the win_A.doModal() was called many times in differrent places.

in this situation ,my own fuction code has to be writen many times.

link publish delete flag offensive edit

answered 2009-04-11 14:55:16 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Hi evpole,

an modal window does not mean that you have no access to his parent window.
If i overhanded the parents controller to the modal window, so i have access to the parent
window and can i.e. actualize a list with a new added item.

Stephan

link publish delete flag offensive edit

answered 2009-04-13 03:43:56 +0800

evpole gravatar image evpole
481 2

Thank you terrytornado !
I've already handle the parents controller to the modal window.
but there's a little problem:
i.e. i would like to set focus to a textbox which was in the modal window,if do it in parent, has to wirtten this code many times.

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: 2009-04-09 07:26:10 +0800

Seen: 315 times

Last updated: Apr 13 '09

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