Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Open web pages using the Winsoft’s component WebView Browser

  1. Introduction

WebView is a VCL-type component (Windows platform only). Its main purpose is to open web pages. To find out how to install the component, watch the next video.

2) Components in the Demo and what they do

On the top of the form a TEdit component is positioned for inserting text (URL in this case), as well as speed buttons for navigation – back, forward, refresh, zoom in, zoom out web page and screen capture. A short video with the Demo describes what it does and how it works.

    

The TEdit component fired and event OnKeyPress when a button from the keyboard is pressed. Inside the method there is a filter for the ‘Enter’ button, which can in the next lines of code.

[crayon-6772cc81ec2ca165238703/]

As you can see in the above code the WebView component loads the inserted text from the TEdit as URL. The speed buttons are disabled by default before an URL is loaded. Once the URL completed loading an OnNavigationCompleted Event is fired from the TWebView component. In the method of the event all the speed buttons status is updated to depending on the WebView flag for certain call, except the Stop Button (X). Respectively its status is always opposite to the others.

[crayon-6772cc81ec2d4305384079/]

Every speed button actually calls a procedure from the TWebView class.

[crayon-6772cc81ec2d6282010443/]

There is also an event for full screen mode of the TWebView component. It’s called OnFullScreenChanged. In this method we check the FullScreen Boolean flag of the WebView and depending on it, some visual settings are applied for better visual experience.

The code for this OBR demo can be downloaded here.

Like what you see? You can get WebView and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4.1 today!

Exit mobile version