Page 1 of 1

Dialog display issue when using Continuations

PostPosted: Mon Jun 27, 2011 7:09 pm
by rossent
Hi all,

We are using Continuations to simulate blocking modal dialogs in the Web Client. However we encounter a strange issue - if a modal dialog is displayed and upon closing of the first dialog a second one is displayed, the Web Client does not show the second dialog. If you use the "Refresh" button on the browser, the second dialog will be displayed when the page is refreshed, but clearly this is not a solution to this problem.

To reproduce the issue, you can use for example the Dialogs Module from Servoy Forge with a simple test like:

Code: Select all
    application.output('Showing first dialog...');
    var _res = globals.DIALOGS.showQuestionDialog('Question Dialog', 'Do you want to display a second dialog?', 'Yes', 'No');
    application.output('The result is: ' + _res);
    if(_res == 'Yes')
    {
        application.output('Showing second dialog...');
        //this second dialog will not be shown in the Web Client until you hit the Refresh button of the browser
        globals.DIALOGS.showQuestionDialog('Second Dialog', 'Is this working?', 'Yes', 'Not Really');
        application.output('After second dialog...');
    }
    else
    {
        application.output('No Second Dialog');
    }
    application.output('Done');


Run the code in both Smart and Web client and notice the difference in behavior. It appears that certain UI changes are not being pushed to the Web Client when Continuations are used. Is this a bug in Servoy or an incorrect usage of Continuations? Any suggestions on how we can make blocking modal dialogs to work on the Web Client is more than welcome.

Thanks for your help.

Re: Dialog display issue when using Continuations

PostPosted: Fri Jul 01, 2011 4:43 pm
by jcompagner
this does currently not work on 5.2

For that there need to be code changes in the dialog module:

dialog_base.js

onhide() must be replaced by something like this:
Code: Select all
function onHide(event) {
   if (continuation)  {
      plugins.scheduler.addJob(controller.getName(), new Date(Date.now()), forms.dialogs_base.continueAndDestroy, 0, 0, null, [controller.getName(), continuation, returnValue])
   }
   else {
      plugins.scheduler.addJob(controller.getName(), new Date(Date.now()), forms.dialogs_base.destroyWindow, 0, 0, null, [controller.getName()])
   }
   application.sleep(100);
   return true;
}

function continueAndDestroy(name,continuation,value) {
   continuation(value);
   destroyWindow(name);
}


problem is that in 5.2 also in servoy we need to have some changes,

that code also doesn't work out of the box directly in 6, a refresh is needed to show the second dialog, i am looking into that now.

Re: Dialog display issue when using Continuations

PostPosted: Fri Jul 01, 2011 10:26 pm
by jcompagner
fixed it also for 6 so a new build of the dialog_module should work in this case for 5.2.10 and the next RC of 6

Re: Dialog display issue when using Continuations

PostPosted: Sat Jul 02, 2011 10:28 am
by ROCLASI
Version 1.1.2 of the Dialog module is now available on ServoyForge.