VLWEB in Popup Window

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jimwatterson
Posts: 26
Joined: Thu Jul 09, 2020 8:31 am

VLWEB in Popup Window

Post by jimwatterson » Fri Mar 19, 2021 10:55 am

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?

User avatar
Dino
Posts: 95
Joined: Fri Jul 19, 2019 7:49 am
Location: Tail of the Dragon, Robbinsville, NC
Contact:

Re: VLWEB in Popup Window

Post by Dino » Fri Mar 19, 2021 1:48 pm

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

jimwatterson
Posts: 26
Joined: Thu Jul 09, 2020 8:31 am

Re: VLWEB in Popup Window

Post by jimwatterson » Fri Mar 19, 2021 3:17 pm

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.

jimwatterson
Posts: 26
Joined: Thu Jul 09, 2020 8:31 am

Re: VLWEB in Popup Window

Post by jimwatterson » Fri Mar 19, 2021 4:29 pm

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)

jimwatterson
Posts: 26
Joined: Thu Jul 09, 2020 8:31 am

Re: VLWEB in Popup Window

Post by jimwatterson » Fri Mar 19, 2021 4:52 pm

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!

Post Reply