On Sun, Apr 26, 2009 at 1:52 AM, Paul Grenyer <[email protected]> wrote:
>
> Hi
>
> Thanks for the response. Yes, what you say is very true. However, it
> doesn't help me. The problem I've got is that I have a method which is
> called just before a tab is closed. If the contents of the tab has
> been modified, but not saved, I want to pop up a yes/no/cancel box so
> that the user can save, not save or cancel the close option. If they
> cancel I need to return false from the original method, otherwise
> true. I don't think that can be done asychronously:
>
> public boolean doBeforeClose()
> {
>    boolean close = true;
>
>    // Show box and reset close.
>
>    return close;
> }
>
> Thanks
> Paul

I'm not sure I understand this requirement. If you're talking about a
GWT tab widget, no user data will be lost when the tab "closes". In a
TabPanel, a Tab close event is usually associated with moving focus to
another tab. No data loss occurs.

Any browser actions that can could result an irretrevable data loss or
irreversable write are , by design, synchronously cancelable (CGI
post, Window.onClose). Does this app. use a TabPanel in a non-standard
way?

For what it's worth, I've also found that it's helpful to simply
implement  automatic, asynchronous "save draft" behavior.Given the
machinery that GWT provides, saving a user's data on their behalf is
nicer than the "old style" technique where one would ask if changes
should be preserved. This technique also provides a nice segue into
some kind of application-specific history support.

This technique supports a "review before post" step. In this step the
draft data are presented for review before posting to the server. The
review -> post transition is synchronous and interruptible.

If "canceling the close"  is really the behavior you want, try
scheduling a deferred command in the onCloseHandler that sets focus to
the tab if the user does not want to close said tab.

>
>
> On Sat, Apr 25, 2009 at 10:54 PM, Vitali Lovich <[email protected]> wrote:
>> Why does it have to be synchronous?  Not sure what kind of message box you
>> are referring to, but it's fairly trivial to convert a synchronous algorithm
>> to an asynchronous one.
>>
>> // synchronous code
>> // message box
>> // synchronous code
>>
>> instead make it
>> // synchronous code
>> // message box
>> // in asynchronous result from message box, continue with synchronous code.
>>
>> On Sat, Apr 25, 2009 at 4:08 PM, Paul Grenyer <[email protected]>
>> wrote:
>>>
>>> Hi All
>>>
>>> I'm using GWT 1.6 and gwt-ext and need a Yes/No/Cancel message box
>>> that is NOT asynchronous.
>>>
>>> Google isn't helping. Can anyone else point me in the right direction,
>>> please?
>>>
>>> Thanks!
>>>
>>> --
>>> Thanks
>>> Paul
>>>
>>> Paul Grenyer
>>> e: [email protected]
>>> w: http://www.marauder-consulting.co.uk
>>> b: paulgrenyer.blogspot.com
>>>
>>>
>>
>>
>> >
>>
>
>
>
> --
> Thanks
> Paul
>
> Paul Grenyer
> e: [email protected]
> w: http://www.marauder-consulting.co.uk
> b: paulgrenyer.blogspot.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to