Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    HtmlViewerCustomGui - get link?

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 426 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 24/03/2017 at 11:37, xxxxxxxx wrote:

      Hello plugincafe community!

      I have a litle question regarding the HtmlViewerCustomGui. Is it possible to not only set but also retrieve the link/webpage the user is currently on? 
      In the python docs only SetUrl is given.

      regards 
      Florian

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 27/03/2017 at 01:31, xxxxxxxx wrote:

        Hi,

        To keep track of the current webpage shown in a HtmlViewerCustomGui, a callback has to be registered.
        Here's some code:

        # In the dialog class define this function
        def HtmlViewerCallback(self, user_data, url, encoding) :
            print "Navigating to " + url
          
        // In the dialog CreatLayout() sets the URL callback
        htmlViewer.SetURLCallback(self.HtmlViewerCallback)
        

        Note the user_data parameter passed to the callback is always None.
        And the optional user_data that can be passed to HtmlViewerCustomGui.SetURLCallback() is not used because of the Python API implementation.

        Also I'm afraid there's no way to get the link the mouse pointer is over.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 28/03/2017 at 08:23, xxxxxxxx wrote:

          Thanks Yannick for the quick reply!

          It does work really well! 
          Altough (and I am not sure if this has anything to do with the HtmlViewerGui) when I am on a website with a facebook like field I only get the link to this facebook field (or like button for that matter) and not the actual link I am currently on.
          Is this because of the script (from facebook) beeing loaded last or is this a bug?

          greetings, 
          Florian

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 29/03/2017 at 04:40, xxxxxxxx wrote:

            The URL callback only gets called when there is a full page load. HtmlViewerCustomGui does not provide dynamic feedback from within a page.

            HtmlViewerCustomGui is quite limited and don't expect much from it. This GUI main purpose is to display the simple HTML files for Cinema's Help.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post