0

Any way to catch the "hide-event" from a window with mode "popup"

asked 2009-04-08 01:25:14 +0800

robertpic71 gravatar image robertpic71
1275 1

updated 2009-04-08 01:26:06 +0800

Is there any event to catch the hide/detach from the test-window, when the user clicks outside this window (i.e. to the dummybutton) - and the test (mode popup) makes an auot-hide?

<window title="My First Window" border="normal" width="200px">
Events
<label id="name"/>
<window title="test" id="popup" mode="popup" closable="true"
onZIndex="name.value+=event.name"
onClose="name.value+=event.name"
onMinimize="name.value+=event.name">
<label value="content"/>
</window>
<button label="dummy"/>
</window>

/Robert

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2009-04-08 02:52:29 +0800

hideokidd gravatar image hideokidd
750 1 2

updated 2009-04-08 02:54:00 +0800

Hi,

It seems ZK doesn't support such events as API.
please use client side action.

http://www.zkoss.org/doc/devguide/ch07s19s02.html

link publish delete flag offensive edit

answered 2009-04-08 15:20:03 +0800

robertpic71 gravatar image robertpic71
1275 1

Thanks, here is my workaround:

<window title="My First Window" border="normal" width="200px">
<script type="text/JavaScript"> 
 <![CDATA[ 
     function test(tx, popup) {
       var sssval = "Off"; 
       tx.value = sssval;
       anima.fade(popup);
       if (document.createEvent) {
         var evt = document.createEvent('HTMLEvents');
         evt.initEvent( 'blur', false, false);
         tx.dispatchEvent(evt);
   
         var evt2 = document.createEvent('HTMLEvents');
         evt2.initEvent( 'change', false, false);
         tx.dispatchEvent(evt2);
       } else if (document.createEventObject) {
         tx.fireEvent('onblur');
         tx.fireEvent('onchange');
       }
     }
     
   ]]> 
</script>
<vbox>
Events
<textbox id="dummy" onChange="name.value += event.value" visible="false"/>
<label id="name"/>
<window title="test" id="popup" mode="popup" closable="true"  position="center"
action="onhide:test(#{dummy}, #{popup})">
<label value="content"/>
</window>
<button label="dummy"/>
</vbox>
</window>	

I don't really know what I do (in Javascript) - but it works...

/Robert

link publish delete flag offensive edit

answered 2009-04-09 01:27:53 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

updated 2009-04-09 01:28:13 +0800

Robert
have you tried onOpen and check isOpen() of event?

<window title="My First Window" border="normal" width="200px">
Events
<label id="name"/>

<window title="test" id="popup"  closable="true" border="normal"
onClose="name.value+=event.name"
onOpen="name.value+=event.name+','+event.open"
onMinimize="name.value+=event.name">
<label value="content"/>
</window>

<button label="popup" onClick="popup.doPopup()"/>
<button label="click" />
</window>

link publish delete flag offensive edit

answered 2009-04-09 10:35:40 +0800

robertpic71 gravatar image robertpic71
1275 1

>> have you tried onOpen and check isOpen() of event?
Damn! No!

It's so easy, thanks dennis.

/Robert

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-08 01:25:14 +0800

Seen: 251 times

Last updated: Apr 09 '09

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