-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, everybody!
I need to do something when window.doModal() was called,which event should i listen to ?
thanks for any help!
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.
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.
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
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.
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
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.
Asked: 2009-04-09 07:26:10 +0800
Seen: 315 times
Last updated: Apr 13 '09