FMX.WebBrowser Sample

From Appmethod Code Examples
Jump to: navigation, search

This sample depicts how to use a TWebBrowser component using FireMonkey.

Location

You can find the WebBrowser sample project at:

Description

This application creates a form that permits loading and displaying web content or local files.

The main form contains a TWebBrowser component that supports the basic functions of a web browser, such as: navigate to URL, go back and go forward.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Object Pascal: WebBrowser.dproj.
    • C++: WebBrowser.cbproj.
  2. Press F9 or choose Run > Run.

Files

The project consists of one source file, uMain.pas, that contains the class for the main form that represents the user interface.

Classes

Implementation

  • The TWebBrowser component calls the Navigate method in order to load and display the content associated with an URL address or a file name.
  • The TClearingEdit component gets the URL address or file name.
  • The btnGo button implements an OnClick event in order to call the event-handler that sets the URL property of the WebBrowser1. Setting this property allows TWebBrowser to automatically call the Navigate method.
  • The btnForward button implements an OnClick event to call the event-handler that calls the GoForward method to navigate to the next URL address or file name in the browsing history list, if any.
  • The btnBack button implements an OnClick event to call the event-handler that calls the GoBack method to navigate to the previous URL address or file name in the browsing history list, if any.

Uses

See Also