PDA

View Full Version : How do you listen for the window close button to be pressed



Manuel1982
2 Jul 2010, 7:47 AM
Like in this post: http://www.sencha.com/forum/showthread.php?101635-How-do-you-listen-for-the-window-close-button-to-be-pressed/page2&highlight=close+click

I need separate hide and the clock on the "x" button because different things shall happen in my application.

Tried with that subclassing example in the mentioned thread, but I can not access the closeBtn so how can I access the close button if I subclass WIndow or Dialog?

sven
2 Jul 2010, 7:52 AM
If you app clothes the window automatically, than it is in another state as if the user clothes the window. Your controller/presenter whatever should easily be able to find out what happend due to the state of your app.

sven
2 Jul 2010, 7:55 AM
Also as the closeBtn is protected, it should be easy to use it in a subclass. Also if it would be private, you could JSNI to access it

sven
2 Jul 2010, 8:04 AM
You could also disable the events completly if you close it manually and enable them after it.

Than you can call your listener also manually.

Manuel1982
2 Jul 2010, 8:25 AM
the closeButton is private. Did it with a different state, but it's not as intuitiv as I thought first

sven
2 Jul 2010, 8:30 AM
Than you are using an older version. You can however also use JSNI to access private members..


Did it with a different state, but it's not as intuitiv as I thought first
It depends on how you structure the code. I never use the presentation layer to distinguish between different states