Adam Patacchiola wrote: > //If i add the listener to the frame here, the outer most > frame is prevented from closing, but the user can still click the > internal document window's close button and the document will close > which is not the behavior I want > /* XCloseBroadcaster xcb = (XCloseBroadcaster)frame; > xcb.addCloseListener(new CloseListener());*/
Well, in fact the frame isn't closed, so there is no reason to ask your listener for permission. There is only one frame object involved, this object and its window are controlled by the "outer" (big) closer. The "inner" closer (the smaller one) does not control a frame it removes the component inside the frame from the frame. This feature was introduced for the last frame (window) of OOo because it allows users to keep OOo in memory without keeping their last document open. > //If i add the listener to the xcomponent, the queryClosing > method is fired when either the internal document's close button or the > frame's close button is clicked, but the document is not prevented from > closing > XCloseBroadcaster xc = (XCloseBroadcaster)xComponent; > xc.addCloseListener(new CloseListener()); No, it should be: usually closing the document window would also close the document (means: destroy it) but this shouldn't happen if you register your listener and veto against closing. Of course you can't prevent the window from being closed here - in fact you can't do it at all as I have to admit. So here's what you should see in the listener you have registered at the document (component): - you get a queryClosing - if you throw a CloseVetoException you shouldn't get any further calls - if you don't object you should get a closing() as well as a disposing() notification. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]