Announcement

Collapse
No announcement yet.

FREE: Web UI (HTML/CSS/JS Interface)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    Hello,
    Thank you for the great plugin and your efforts. I have followed the setup instructions and created my widget on UE 4.25. I seem to have a problem about Focus. The default BP setup shown in HUD is not focusing after creation. Player needs to click on the widget to gain focus. But adding a delay(min 0.3s) after last node which is Load File and calling helper function Focus on Browser(variable returned from GetBrowser) after the delay seems to fix this. Calling Focus function just after Load File also doesn't seem to work. This might be related to load times and instances not being available at the time. Can we double check this if this is a bug or if this is just an error on my side. Thank you.

    Comment


      #62
      Originally posted by plyroth View Post
      Hello,
      Thank you for the great plugin and your efforts. I have followed the setup instructions and created my widget on UE 4.25. I seem to have a problem about Focus. The default BP setup shown in HUD is not focusing after creation. Player needs to click on the widget to gain focus. But adding a delay(min 0.3s) after last node which is Load File and calling helper function Focus on Browser(variable returned from GetBrowser) after the delay seems to fix this. Calling Focus function just after Load File also doesn't seem to work. This might be related to load times and instances not being available at the time. Can we double check this if this is a bug or if this is just an error on my side. Thank you.
      What you're discovering is the disconnect between the game instance and the browser instance and there is already a mechanism in the example project that handles all of this for you that you might be overlooking.

      Basically there's no reason to be calling Focus() immediately after the LoadFile() function. In fact if the browser widget hasn't even created the internal viewport widget yet, there is no way for the Focus() function to find it, so it won't even work anyway if you call it prematurely before the widget has fully initialized. Instead let's go over a typical setup which is demonstrated for you in the example project...

      You first create the browser widget, add it to the viewport (set it to hidden) and load your initial file. During this time you could be displaying a loading image or a loading widget while the browser widget is hidden. At this point you've handed off control to the browser instance, so the game instance should be waiting for some kind of confirmation from the browser instance that the page was successfully loaded before making the widget visible.

      So what you do is register a jQuery.ready() event in your HTML page that will send an event to the game instance once the page is ready. In terms of JavaScript this means the $.ready() function calls ue4("ready") which then changes the browser widget visibility from hidden to visible (and could hide your loading image/widget).

      It is here in the UE4 ready event (the moment you make it visible) that you want to set focus to the browser widget. This guarantees the internal viewport widget has already been created, and that your page actually loaded correctly before handing off focus. Otherwise if your ready event is not called after a certain amount of time, you can assume the browser did not load correctly and handle your error (such as sending a report using the HTTP blueprint plugin or displaying an error widget).

      So long story short, create a boolean variable in your blueprint called "ready" and setup a 5-10 second delay node after you call the LoadFile() function (and initially hide the browser widget). If the boolean is still false after the delay, then handle your "interface failed to load" error situation. Now create a "ready" case in the switch of your broadcast event and have it set the boolean variable to true, make the widget visible, and then focus the browser widget (don't forget to register a jQuery ready event that will broadcast your UE4 ready event).

      Comment

      Working...
      X