Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: GWC - How to automatically close an application Web Window  (Read 17164 times)
Sundar K.
Posts: 17


« on: May 01, 2009, 03:42:02 pm »

GWC uses 'EndingPage.xhtml' to place the user when the application closes normally.

I use tabs to launch applications and would like to close this page automatically.  I have tried various tricks with Javascript to no avail.  Can anyone help ?
.
Four Js
Posts: 65


« Reply #1 on: May 06, 2009, 02:15:07 pm »

Hi Thomas,

What GWC version do you use ? Is it a 2.02 version ?
Actually, it should be ok with the latest version of GAS/GWC 2.11 and 2.20.
If not, please send me your test program and explain what you expect.

Thanks and Regards,
Sundar K.
Posts: 17


« Reply #2 on: May 06, 2009, 03:03:24 pm »

Attached is the Web side material.  I can assemble the Application side Genero BDL if you like--  but what I want to do is open an application in an 'iframe' tab and when the application closes, remove the tab.

My next idea is to use Javascript to create the 'iframe' with 'document.open', give it an 'id' attribute and then use some Javascript in 'EndingPage.html' to do a 'document.close'.

* TabControl.tgz (1.09 KB - downloaded 1348 times.)
.
Four Js
Posts: 65


« Reply #3 on: May 06, 2009, 03:25:32 pm »

Hi,

Yes, please also send me the 4gl and form files and let me know what GWC version you are using.

Thanks,
Sundar K.
Posts: 17


« Reply #4 on: May 06, 2009, 05:40:52 pm »

FGL 2.11.05 / GAS 2.11.12

To install:
  cd $FGLDIR/demo
  tar xvfz hellow.tgz

Cut and paste the following into $FGLASDIR/etc/as.xcf and bounce gasd:
      <APPLICATION Id="gwc-hellow" Parent="defaultgwc">
        <EXECUTION>
          <PATH>$(res.path.fgldir.demo)/hellow</PATH>
          <MODULE>hellow.42r</MODULE>
        </EXECUTION>
      </APPLICATION>

By the way, I cannot get even the simplest Javascript to work in $FGLASDIR/tpl/common/EndingPage.xhtml, like:
    <body onload='alert("onLoad...");'>






* hellow.tgz (1.83 KB - downloaded 1340 times.)
.
Four Js
Posts: 65


« Reply #5 on: May 13, 2009, 03:57:04 pm »

Hello Thomas,

To automatically close your tabs using javascript, you will have to use the markers.

https://4js.com/online_documentation/fjs-gas-2.11.01-manual-html/User/CustomizeJS.html

Create a new javascript file in the "FGLASDIR/web/fjs/" directory:

myfile.js:
---
Code
  1. gwc.componentSet.application.end2 = function( polarity, eid, cid, component, data )
  2. {
  3. window.close();
  4. }
---

In this file, there is only a "close" action but you can add an "alert()" statement just to test.
Then, you will have to call this function in the main.xhtml file; define your new javascript file "myfile.js" and your new "end2" instruction:

FGLASDIR/tpl/set1/main.xhtml:
---
Code
  1. <head>
  2. ...
  3. <script type="text/javascript" gwc:attributes="src application/connectorURI+'/fjs/myfile.js'" defer="defer"> </script>
  4. ...
  5. </head>
  6. <body gwc:marks="
  7. ...
  8. end2 application/state/ended/normal?[application/CID]:null;
  9. ...
---   

Thus, when a "close" action will occur, "myfile.js" will be executed.   
Note that since GAS/GWC 2.11 the child windows/tabs of your application should automatically close when executing a "close" action on them.   
Note that the behaviour can differ according to the browser; with the changes above, even the main application window could be closed with IE but not with Firefox.

Best regards,
Sundar K.
Posts: 17


« Reply #6 on: May 18, 2009, 05:15:01 pm »

This helped a great deal thanks !

However, after doing the window.close the DOM is left unchanged and I had to add some code to remove the 'iframe':

gwc.componentSet.application.end2 = function( polarity, eid, cid, component, data )
{
        window.close();
        var eIFrame=window.frameElement;
        eIFrame.parentNode.removeChild(eIFrame);
}
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines