3 Replies Latest reply on Jun 13, 2012 8:26 AM by steve_ssh

    GetLayoutObjectAttribute stays empty from page in webviewer

    Menno

      Hi Everyone,

       

      in the attached file i am attempting to capture an anchorlink after a user has clicked on a car in the parking with:

       

      GetLayoutObjectAttribute( "webviewer" ; "source" )

       

      This works perfectly on windows and macos where i have the image and the html-page written to and read from in the temporaryfolder.

       

      However this scheme doesn't work on iOS because it is not allowed to show local files in a webbrowser (and thus not in a webviewer). I solved that by putting the image as a base64-encoded text-string in a field and show the html-file directly from the field where i generate it with the image embedded in the html. I would expect that the webviewer would give me the same result with GetLayoutObjectAttribute( "webviewer" ; "source" ) when i click on a car or parking-space on my iPad, but it doesn't, it allways returns the full html-code of the page.

       

      Does anyone of you have an idea on how to approach this?

       

      thank you for any reaction

       

      regards, Menno

        • 1. Re: GetLayoutObjectAttribute stays empty from page in webviewer
          steve_ssh

          Hello Menno,

           

          From within the context of FMGo12 you will probably have an easy time realizing your objective if you utilize the FMP URL protocol functionality.  This functionality allows you to invoke scripts defined in your FM solution by launching a URL.  This includes launching a URL by clicking on a link from within a webviewer .  Once you are familiar with this technique, I think that you will find it very easy to use.  Below I will include some help to get you started with this.

           

           

          Some references:

           

          The documentation regarding the FMP URL protocol is here:

           

               http://www.filemaker.com/12help/html/sharing_data.16.7.html

           

           

          A fun blog article which illustrates sophisticated use of the FMP URL invoked from a webviewer is here:

           

               http://buzz.beezwax.net/2012/04/21/native-web-2-0-controls-in-filemaker-12-layouts

           

           

           

          Sample File:

           

          I will attach a modified version of your Parking file which illustrates one possible way you could go about this with a minimal amount of change to your existing code.

           

          The modified version has the following changes from the original file which you posted:

           

          Field Modified:

           

             Table:  Space

             Field:  _DIV

           

           

          Scripts Modified:

           

             SelectParking

             Set filesource

           

           

          Scripts Added:

           

             webviewer auto-refresh___ADDED

           

           

           

          Question for you:

           

          I noticed that performance of this file seems rather sluggish on FM Go.  I took a closer look under the hood to see why this might be the case, and I believe that some modifications to how you generate the webviewer content could help speed things up, thus making the UI more responsive to the user's clicks. In particular, I am concerned with the fact that I see multiple calls of the List function against various unstored calculations.  Even over a small set of records, the performance hit seems noticeable.  I took a look at what this list data accomplishes within the generated HTML source, and my suspicion is that some small changes to the CSS strategy could significantly improve this situation.  The existing code is certainly very logical in its methodology, but it does not appear to have been designed with your particular application in mind.

           

          A few possibilites occur to me:

           

            - You haven't noticed any poor performance on your end

             - You are fully aware of this, and simply haven't reached the point where you are optimizing the code

             - The HTML and CSS code was originally generated by a tool to help create image maps suitable for use in a variety of contexts, but not specifically for use within the context of FM Go.

           

          Do you have any comments regarding the above?  Please note that my intention is not to needlessly tear apart your code to critique it.  My motivation is to stir up some ideas to perhaps get a good idea to run better.

           

          Kind regards,

           

          -steve

          • 2. Re: GetLayoutObjectAttribute stays empty from page in webviewer
            Menno

            Hello Steve,

             

            thank you, thank you! This was exactly where I got stuck! It simply did not occur to me that I didn't need the scripttrigger anymore, I have been fooling with the FMP-protocol but I had left the scripttrigger on the webviewer and lead me to believe that the problem was unsolvable without doing massive changes. Your changes clearly show that it can be done with a few minor changes.

             

            I noticed the poor performance and haven't come around to optimizing the code and I designed this originally for a desktop environment, using it on iPads is just a new (and interesting) application ;-)

             

            I don't mind being criticized at all, in my view it is what helps people to gather knowledge and get better at what they do, there is allways room for improvement. So thank you very much for your remarks and I will put them to good use ;-)

             

            Again thank you very much for your additions and your comments, they are much appreciated

             

            best regards, Menno

            • 3. Re: GetLayoutObjectAttribute stays empty from page in webviewer
              steve_ssh

              Hello Menno,

               

              Excellent!  I am so pleased that this was helpful.  Thank you for your post.

               

              Very best,

               

              -steve