My guess is that the 'return 1' is happening in the scope of the window and
not in the scope of the function so your function never knows what was
clicked. If I was to solve this problem, I would create a property in the
window to hold the selected value, then when the window is closed you can
check that value from within your function to check the result, IE:
win.getResult().
Jim
On Mon, Feb 2, 2009 at 12:56 PM, <i...@simply-notes.de> wrote:
> Hi all,,
>
> I'm fairly new to qooxdoo but started to port a Lotus Notes based
> application to qooxdoo -. that's fun ;-).
>
> What I have a problem with is to implement a Messagebox which can be called
> from anywhere in the application and returns a value based on the button
> clicked. The gui work is easy with qooxdoo but the routine calling my
> Messagebox function does not "wait" for the returncode.
>
> The Messagebox is based on a qooxdoo window and after calling the open
> method the code after the call to Messagebox get's executed
>
> Sample
>
> var rc = myApp.MsgBox('', myApp.tr("Are you sure to delete the selected
> user"),4,3,myApp);
> if (rc == 6) {
> alert("x");
> }
> else {
> alert(rc);
> }
>
> above code result in an alert with 'undefned' popping up right before the
> messagebox appears
>
> How can I stop execution until user closed the messagebox?
>
>
> Msgbox function is as follows (fragment)
>
> //*************************************************************************
> MsgBox : function(mboxTitle, msg, btnType, iconType, myApp)
>
> //*************************************************************************
> {
> var btnWidth = 70;
> var btnGap = 4;
>
> switch (iconType) {
> case 1: //information
> iconSource =
> 'resource/icons/32/dialog-information.png';
> break;
> ...
> }
>
> var win = new qx.ui.window.Window(mboxTitle);
>
> win.setLayout(new qx.ui.layout.Canvas);
> win.setModal(true);
>
> win.open();
> win.center();
>
> var atom = new qx.ui.basic.Atom(msg, iconSource);
> atom.setRich(true);
> win.add(atom, {top: 5, left: 5, width: '90%'});
>
> switch (btnType) {
> case 0: //OK button (default)
> var btnOK = new qx.ui.form.Button(this.tr("OK"));
> btnOK.setWidth(btnWidth);
> win.add(btnOK, {bottom: 5, right: 5});
>
> btnOK.addListener("execute", function(e) {
> this.close();
> return 1;
> }, win);
>
> break;
> ...
> }
> ...
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel