Four Js Development Tools Forum

Discussions by product => GDC => Topic started by: James S. on October 10, 2013, 03:28:22 am



Title: Embedded Browser in Genero 2.30
Post by: James S. on October 10, 2013, 03:28:22 am
Hi all,

I am trying to use the embedded browser that was introduced in Genero 2.20 on my Genero 2.30 system in order to display a webpage.

Does this feature still exist in Genero 2.30?

If so, could someone please give me an example of how to set up the embedded browser, as I am having trouble getting it working using the existing documentation.

Thanks,

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 10, 2013, 03:45:34 am
Are you using a TEXTEDIT or an IMAGE?  It was moved from TEXTEDIT to IMAGE somewhere around those versions you mention.

https://4js.com/online_documentation/fjs-fgl-manual-html/User/PresentationStyles.html#STYATT_IMAGE

Other thing to watch out for perhaps, are you using 32-bit GDC or 64-bit GDC?


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 10, 2013, 04:21:06 am
Hi Rueben,

I tried both, but I may have to try again I guess.

I am using 32 bit version of the GDC.

This may be my lack of knowledge, but I am meant to do something like the following within a style file yes?

 <Style name="image.browser">
    <StyleAttribute name="ImageContainerType" value="browser"/>
  </Style>

Thanks,

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 10, 2013, 04:36:23 am
I can never remember when case is important but try this ...

Code
  1.   <Style name="Image.browser">
  2.    <StyleAttribute name="imageContainerType" value="browser"/>
  3.  </Style>


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 10, 2013, 04:50:29 am
Hi Rueben,

Thanks for the help. Unfortunately, this did not resolve the trouble I am having.

When running the program, it just results in a white square where the image is, instead of the embedded browser that I am expecting.

Thanks,

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 10, 2013, 06:54:36 am
This is my little test ...
Code
  1. MAIN
  2.    CALL ui.Interface.loadStyles("browser")
  3.    CLOSE WINDOW SCREEN
  4.    OPEN WINDOW w WITH FORM "browser"
  5.    #DISPLAY "https://4js.com" TO browser
  6.    #DISPLAY "http://www.google.com" TO browser -- redirection issue
  7.    DISPLAY "https://4js.com/online_documentation/fjs-fgl-manual-html/" TO browser
  8.    MENU ""
  9.        ON ACTION close
  10.            EXIT MENU
  11.    END MENU
  12. END MAIN

Code
  1. LAYOUT (TEXT="Browser")
  2. GRID
  3. {
  4. [browser                                 ]
  5. [                                        ]
  6. [                                        ]
  7. [                                        ]
  8. [                                        ]
  9. [                                        ]
  10. [                                        ]
  11. [                                        ]
  12. [                                        ]
  13. [                                        ]
  14. }
  15. END
  16. ATTRIBUTES
  17. IMAGE browser=formonly.browser, STRETCH=BOTH,STYLE="browser";

Code
  1. <StyleList>
  2.   <Style name="Image.browser">
  3.    <StyleAttribute name="imageContainerType" value="browser"/>
  4.  </Style>
  5. </StyleList>






Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 10, 2013, 07:10:28 am
Hi Reuben,

Trying something like that,

Code
  1.    <Grid name="grid2" width="47" height="23">
  2.        <Image name="browser" width="43" height="20" image="http://news.customs.gov.au/RSS_news_feed.asp?CAT=1" style="browser" posY="1" posX="3" gridWidth="43" gridHeight="20"/>
  3.    </Grid>
  4.  

Code
  1. <Style name="Image.browser">
  2.   <StyleAttribute name="imageContainerType" value="browser"/>
  3. </Style>
  4.  

Code
  1. DISPLAY "http://news.customs.gov.au/RSS_news_feed.asp?CAT=1" TO browser

And genero is happily telling me:

FORMS statement error number -1102.
Field (browser) not found in form.


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 10, 2013, 07:41:17 am
I think you have a Static Image in your form, not a Dynamic Image field.

A static image remains the same, whilst a dynamic image can be DISPLAY'ed to.

https://4js.com/online_documentation/fjs-fgl-manual-html/User/FormSpecFiles.html#FF_ITEMTYPE_IMAGE


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 10, 2013, 07:48:37 am
Thanks, that was the cause of that error.

As you can probably tell, I am still fairly new to the GDC.

However, it is still displaying as an empty white square instead of the page I am expecting to show.

I have tested with the link you used also, with the same result.


Title: Re: Embedded Browser in Genero 2.30
Post by: Lionel F. on October 10, 2013, 10:00:28 am
Hello James,

By any chance, does your internet connection pass through a proxy?

If so, you need to specify the proxy settings in the connection tab of the options panel. Indeed, by default GDC doesn't inherit the system proxy settings.

Best regards,
Lionel


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 10, 2013, 11:30:45 pm
Hi Lionel,

Good question, and probably the right one to ask.

I probably am behind a company proxy which would be stopping it.

I will try again once I have the details and post the results.

James


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 11, 2013, 12:12:49 am
Well it seems I dont have access to the options panel on my machine.

It was suggested to me that I could instead try to display a local html file as a check to see if it is the proxy causing issues.

However this resulted in the same white square.

Is it possible to display local files in the embedded browser?


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 11, 2013, 12:18:51 am
James,

Re: the options panel, start the GDC in admin mode (-a) https://4js.com/online_documentation/fjs-gdc-manual-html/User/CmdLine.html

If you are planning to use the RSS News Feed URL you had in an earlier post, you may find that after you overcome the proxy issue you will be disappointed.

In my small program if I use the GDC and your URL I get what looks like raw html, if I use the GWC I get a page similar to what I see in a browser.  For the GDC note this disclaimer in the documentation https://4js.com/online_documentation/fjs-fgl-manual-html/User/PresentationStyles.html#STYATT_IMAGE
"Note: This feature uses the WebKit Open Source project as provided with Qt, and has limitations such as no Java or ActiveX support. It will display HTML / rich text, but may encounter difficulties with more complex Web pages"

An alternative way to read this RSS news feed would be to use the methods in the com library to read the RSS news feed into an XML document, and from there you can filter out what parts of the news feed you want to display

Code
  1. IMPORT com
  2. IMPORT xml
  3. DEFINE req com.HttpRequest
  4. DEFINE resp com.HttpResponse
  5. DEFINE str STRING
  6. DEFINE doc xml.DomDocument
  7.  
  8.    LET req = com.httpRequest.Create("http://news.customs.gov.au/RSS_news_feed.asp?CAT=1")
  9.    CALL req.doRequest()
  10.    LET resp = req.getResponse()
  11.    -- Either read as string or XML
  12.    LET doc =resp.getXmlResponse()
  13.    #LET str = resp.getTextResponse()  

Reuben


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 11, 2013, 12:21:35 am
Hi Rueben,

Thanks for the reply.

However I have been told to drop the idea of an external webpage for the time being and focus on trying to get a local html file to work instead.

Any comment on if it should or shouldn't work?

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 11, 2013, 12:43:20 am
Probably not...

Bz15152 Integrated browser: being able to display a local html file using "file:///" protocol

...fixed in GDC 2.50.00


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 11, 2013, 12:59:34 am
Thanks for the reply Rueben,

Damn oh well, time to find another way.


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 14, 2013, 01:35:06 am
Hi all,

Sorry to open this up again.

I have joined the 2.50 EAP, installed it, and tried again.

I am still getting the empty white square when pointing to a file, which may be because it is not yet implemented in the EAP, however when going into the stylesheet, I found it had new errors in 2.50. Most of them didnt affect me and I removed the offending lines, however one did.

The imageContainerType styleAttribute line has an error stating: Value 'imageContainerType' not in enumeration.

The program still runs despite this error, but I am unsure of it.

Is this a bug of the EAP or is it being changed how this feature is used?

Regards,

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 14, 2013, 02:31:02 am
James,

We have a couple of different communication options.

1. If you are in the EAP program and you discover a change in behaviour with the EAP version compared to the previous version, or have a query about some new functionality in the EAP version, then you should raise that in the EAP mailing list.  Details of which are provided when you join the EAP

2. If you have an issue with a released version of Genero, or you have a howto question, then you should contact your local support center.

So in this instance, the" Value 'imageContainerType' not in enumeration: message is not an EAP issue because it also occurs in a release version of Genero.   I get the same error message using GST 2.41.31.  So for this, you should be sending a mail to your local support center.

Now for your other issue, when communicating with the forum or support, you should provide an overview of what you are trying to do.  So in this instance, you probably want to say something along the lines of "I want my Genero program to display the output of this RSS feed http://news.customs.gov.au/RSS_news_feed.asp?CAT=1"

By giving this overview, it maybe that you are going down the wrong path and someone may open an alternative way of doing the task.  So if the above is what you want do do, have you considered using the launchurl frontcall CALL ui.Interface.frontCall("standard","launchurl","http://news.customs.gov.au/RSS_news_feed.asp?CAT=1",[]), or if you don't want to launch a browser using the com/xml libraries to read the RSS feed into a 4gl program and display parts of it via DISPLAY ARRAY and/or TEXTEDIT.

The other thing you should do is provide a small example that illustrates your issue.  Your issue with the file maybe because you have the wrong number of slashes but there is no way of us knowing that.  So take the example I posted earlier and modify it to reproduce your issue.  If we have an example that works in our environment, but the same doesn't work in your environment then we also know we can start looking for environment type issues such as the proxy server that Lionel mentioned.

Hope that all makes sense

Reuben


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 14, 2013, 02:41:23 am
Hi Rueben, Thanks for the reply.

As stated in a previous post, I have been told to scrap the idea of reaching an external page for the time being and I am merely trying to reach a local html file on the machine and display that.

Code
  1. FUNCTION sixteen()
  2.  DEFINE
  3.    win ui.Window,
  4.    myForm ui.Form,
  5.    id, i INTEGER,
  6.    d ui.Dialog
  7.  
  8.  #OPEN WINDOW win_sixte WITH FORM "sixte" ATTRIBUTE (border)
  9.  OPEN FORM Form1 FROM "sixte"
  10.  DISPLAY FORM Form1
  11.  
  12.  #DISPLAY "http://news.customs.gov.au/RSS_news_feed.asp?CAT=1" TO browser
  13.  DISPLAY "file:///C:/Users/jsunderland/Documents/My%20Genero%20Files/fpacmenu250/webcomponents/industrial/Google.html" TO browser
  14. END FUNCTION
  15.  

I am using a 4fd file rather then a handwritten screen, however the relevant parts of the resulting 42f file are below
Code
  1.  <Folder name="folder1">
  2.        <Page name="page1" action="industry" text="Industry News">
  3.          <LStr text="Industry News"/>
  4.          <Grid name="grid2" width="47" height="23">
  5.            <FormField name="formonly.browser" colName="browser" sqlType="CHAR" fieldId="12" sqlTabName="formonly" noEntry="1" tabIndex="20">
  6.              <Image width="43" height="21" style="browser" posY="1" posX="3" gridWidth="43" gridHeight="21"/>
  7.            </FormField>
  8.          </Grid>
  9.        </Page>
  10.  

And the styleSheet is still the same with:

Code
  1. <Style name="Image.browser">
  2.   <StyleAttribute name="imageContainerType" value="browser"/>
  3.  </Style>
  4.  

If there is anything I can do to help solve this issue I am having quicker, please let me know

Regards,

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 14, 2013, 04:06:53 am
You can always attach files to your posts.  So attach your example 4gl/4fd/4st files if in doubt.  If you do attach a .4fd, please specify the version of Studio used to create it.  Also if your files have a schema attach that as well although this simple example should not need one.

Looking at your pathname, I am suspicious that the html file you are trying to load is complex.  Have you tried creating a simple html file and loading that e.g.

Code
  1. Hello World
  2. </body>
  3. </html>


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 14, 2013, 04:13:47 am
Hi Rueben,

Sorry, I never considered uploading the files....

As for the complex file question, the path should be ignored as to the files complexity, it is a remnant from a previous attempt at something.

The file i was trying to load was a copy of the basic google search page, for testing. I also created a hello world page and tried that with the same result.

The 4fd was originally created in 2.30 on my main project and then was converted upon being opened and saved within GST 2.50.



Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 14, 2013, 04:15:54 am
And I realised too late that I didn't attach my 4gl or 4st, so please find that attached to this post.


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 14, 2013, 04:55:42 am
Thanks for the attachments but that is not a small example that allows us to reproduce the problem.

I am expecting to see a 4gl similar to ...

Code
  1. MAIN
  2.    CALL ui.Interface.loadStyles("browser.4st")
  3.    CLOSE WINDOW SCREEN
  4.    OPEN WINDOW w WITH FORM "browser"
  5.  
  6.    DISPLAY "file:///C:/Users/jsunderland/Documents/My%20Genero%20Files/fpacmenu250/webcomponents/industrial/hello.html" TO browser
  7.  
  8.    MENU ""
  9.        ON ACTION close
  10.            EXIT MENU
  11.    END MENU
  12. END MAIN

With your 4gl I don't see anything loading the stylesheet.   

With your attachments please remember we don't have access to your libraries and database so any example to reproduce an issue needs to be small and self-contained.  With what you sent, all we can do is read it and look for obvious errors.  We can't compile it as we would also need globals.4gl and fpacmenu.sch.  We can't run it because we don't have your libraries and database.

Reuben


Title: Re: Embedded Browser in Genero 2.30
Post by: James S. on October 14, 2013, 05:06:50 am
Hi Rueben,

I feel like a rather large idiot right now.

The problem lied in the fact that I was not using the CALL ui.Interface.loadStyles("browser.4st") call. I had assumed that this was handled by the Studio when I chose the style file in the properties panel.

The result has not turned out perfectly, with the menu bar on the right disappearing as the browser showed up, but this particular problem is solved.

I am sorry that I wasted so much time because of an assumption.

Regards,

James


Title: Re: Embedded Browser in Genero 2.30
Post by: Reuben B. on October 14, 2013, 05:19:22 am
No worries.

What you probably want to do is add the 3 lines ...

Code
  1. <Style name="Image.browser">
  2.  <StyleAttribute name="imageContainerType" value="browser"/>
  3. </Style>

... into your applications style sheet

Reuben