UserGuide

Web Pages

From Xojo Documentation

A Web app's user interface exists in your projects's web pages. You create your user interface by creating web pages and adding controls such as Buttons and Check Boxes. By default, a Web Application project has one web page (WebPage1) that is displayed automatically when the app runs. Typically, you will begin designing your app's interface by adding controls to this web page and enabling the controls by writing code.

To add additional web pages to an application:

  • Add a new web page to the project by clicking the Insert button on the toolbar or menu and selecting Web Page.
  • Add controls to the web page from the Library.
  • Add code as needed.
  • Add code to display the web page in the finished application.

Web Pages have a hierarchy. The base class is WebObject. WebControl subclasses WebObject. WebView subclasses WebControl. WebPage subclasses WebView.

Commonly used events, properties and methods are described below. Refer to WebPage in the Language Reference to a complete list of events, properties and methods.

Web Page

Events

Close

The web page is closing.

ContextualMenuAction

Called when an item in a ContextualMenu was selected.

DoubleClick

Called when the user double-clicks on the web page.

Hidden

Called when the control is about to be hidden because another page is about to be shown.

KeyPressed

Called when the user presses a key while the web page has focus.

Open

Called when the web page has been created but before it is displayed. Unlike with desktop projects, you should instead use the Shown event to initialize the web page or any of its controls.

Resized

Called after the browser page is resized.

Shown

Use the Shown event instead of the Open event to initialize the web page or any of its controls.

Properties

ContextualMenu

Assign a WebMenuItem to display the menu when the user contextual-clicks on the page.

Cursor

Used along with System.WebCursors to change the cursor when the pointer is in the page.

Enabled

When False, disables all controls on the page.

HelpTag

Set to the text you want displayed in a tooltip when the mouse is hovered over the page.

ImplicitInstance, IsImplicitInstance

When ImplicitInstance is True, you can refer to the web page by its name (instead of having to declare an explicit instance using New). IsImplicitInstance allows you to check if the page was created implicitly.

Height, Width

Used to get the height and width of the page.

MinHeight, MinWidth

If the browser size is set smaller than the minimum width or height, scroll bars appear so that you can still see the content.

Name

The name of the web page.

Style

Assign a Style to this property to change the look and feel of the web page (such as its background color).

Title

The text that appears in the Title Bar of the web browser.

Visible

Hides all the contents of the page.

Methods

Close

Closes the page.

ScrollTo

Scrolls the page to the specified coordinates. This affects scrolling for all subsequently displayed pages as well.

Show

Displays the page. If ImplicitInstantiation is True, then you can show a page simply by using WebPageName.Show.

See Also

UserGuide:Web UI, UserGuide:Web Control Hierarchy topics