Hi Lutz,

which qooxdoo version do you use?

Can you please test this code in a skeleton:
var win = new qx.ui.window.Window("First Window");
win.open();
     
var doc = this.getRoot();
doc.add(win, {left: 100, top: 50});

win.addListener("beforeClose", function(e) {
  this.debug("beforeClose");
  e.preventDefault();
}, this);

I use the current trunk (0.8.3-pre) and this example works.

Thanks,
Chris


Lutz Schoder schrieb:
> Hi Chris,
>
> yes I have.
>
> In the api documentation I found the preventDefault() method for the 
> beforeClose Event
> of windows but the error message was the same. Thats why I tried the 
> close Event.
>
> Regards
> Lutz
>
>
> Christian Schmidt schrieb:
>   
>> Hi Lutz,
>>
>> Have you tried "beforeClose" instead of  "close". I think this could 
>> solve your problem, but I haven't tried it.
>>
>> Cheers,
>> Chris
>>
>>
>> Lutz Schoder schrieb:
>>   
>>     
>>> Hi All,
>>>
>>> I'm searching for a solution to ask the user for saving changes before
>>> closing the window. I tried it like this:
>>>
>>>     construct : function(params) {
>>>         this.__closing = false;
>>>         ...
>>>         this.addListener("close", function(evt) {if (!this.__closing) 
>>> {this.__close("START", evt);}});       
>>>         ...
>>>
>>>        __close : function(code, evt) {
>>>             switch(code) {
>>>                 case "START" :
>>>                     evt.preventDefault();                  
>>>                     if (this.__panel.isEdited()) {
>>>                         new 
>>> scqx.ui.dialogs.QuestionDialogYesNoAbort(this.tr("Save Changes"),
>>>                                                         this.tr("Would 
>>> you save your changes before close?"),
>>>                                                         this,
>>>                                                         
>>> "SAVE_BEFORE_CLOSE", evt);
>>>                     } else {
>>>                         this._close("CLOSE", evt);
>>>                     }
>>>                     break;
>>>                 case "SAVE" :
>>>                     this.__save();
>>>                     this._close("CLOSE", evt);
>>>                     break;
>>>                 case "CLOSE" :
>>>                     this.__closing = true;
>>>                     ...
>>>                     this.close();
>>>                     break;
>>>             }
>>>         },
>>>
>>> The answer of the user is translated by callback functions to calls of 
>>> this.__close("SAVE", evt) or
>>> this.__close("CLOSE", evt).
>>>
>>> But I got the message
>>>  Assertion error! Cannot prevent default action on a non cancelable 
>>> event: close: Called assertTrue with 'false'
>>>
>>> How can I stop the close?
>>>
>>> Thanks
>>>
>>> Lutz
>>>                  
>>>
>>>   
>>>     
>>>       
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>> Series Scanner you'll get full speed at 300 dpi even with all image 
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>   
>>     
>
>
>   


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to