Page 1 of 1

VLWEB in Popup Window

Posted: Fri Mar 19, 2021 10:55 am
by jimwatterson
I'm displaying a VLWEB Webpage in a javascript popup window.

var url = "/dc-pgmlib/TST/mypage.html";
.
.
var opt = "width=900,height=600,directories=no,toolbar=no,";
opt += "menubar=no,scrollbars=yes,resizable=yes,location=no,status=no";

var win;
win = window.open(url,'examtimetable',opt,true);

A window popped up like this can contain javascript to close itself from a button with;

window.close();

It is also able to call function in its parent, passing parameters back with:

self.opener.JPopUpAssign(actionStatus, selectionKey);

Does anyone know how to accomplish this from a VLWEB webpage?

Re: VLWEB in Popup Window

Posted: Fri Mar 19, 2021 1:48 pm
by Dino
while it will be awesome to have something like this:

Code: Select all

#sys_web.javascript( 'window.close();' )
what we currently have, is widgets. Lets say I create a new widget , i called it rauljavascriptfunctions, as object (no control which means that I dont need anything to show in the screen), then add a method in the definition tab (right button in the method section of the widget) and it will look like this:
Image

then you copy this sample code in the left to the implementation section of the widget and add the window.close() ... dont need to look or touch the rest :

Image

Code: Select all

  //-------------------------------
  // WIDGET-PROPERTY IMPLEMENTATION
  //-------------------------------

  //
  // windowclose - Close a Windows
  //
  // Return Type: Boolean
  //
  PROTOTYPE.windowclose = function()
  {

    // Implementation...
  window.close();

    return false;
  }
Compile it. Then you go to your LANSA webpage, drag and drop the widget there, and when you need it, just call the windowclose method in your widget. and voala, it works correctly.

Image

You can add the rest of javascript functions in the same way to the widget, with parameters send from the webpage, properties if you need, etc.

Image

Re: VLWEB in Popup Window

Posted: Fri Mar 19, 2021 3:17 pm
by jimwatterson
Thanks Dino, that's a very comprehensive answer. I'll give it a go. I suspected it might be a widget issue but I was hoping there might be something built in that I had missed.

Re: VLWEB in Popup Window

Posted: Fri Mar 19, 2021 4:29 pm
by jimwatterson
I've just implemented the windowclose method and it worked out of the box!
Thanks again.

(Good to see a bit of activity on this forum)

Re: VLWEB in Popup Window

Posted: Fri Mar 19, 2021 4:52 pm
by jimwatterson
Just to finish on a high - the NotifyParent window worked out of the box too.

Its Friday evening here, a good time to knock off and go for a beer!