Class

WebTabPanel


Description

Used to organize controls into groups of tabs that can be selected by the user. Only the controls on the selected tab are visible.

Methods

Name

Parameters

Returns

Shared

AddControl

Child As WebControl

Close

ControlAt

Index As Integer

WebControl

ExecuteJavaScript

Script As String

GotoURL

Url As String, inNewWindow As Boolean = False

LastPanelIndex

index As Integer

SetFocus

UpdateBrowser

Events

Name

Parameters

Returns

Closed

ContextualMenuSelected

hitItem As WebMenuItem

Hidden

Opening

Overflowed

width As Integer, height As Integer

PanelChanged

Resized

Shown

Property descriptions


WebTabPanel.ContextualMenu

ContextualMenu As WebMenuItem

If you assign a WebMenuItem to the control, it will be displayed when the user right-clicks the control.

On a WebPage, you can disable/remove the default contextual menu by an empty WebMenuItem class object to this property.

This code populates a contextual menu in the Shown event of the control.

Var menu As New WebMenuItem

menu.AddMenuItem("One")
menu.AddMenuItem("Two")
menu.AddMenuItem("Three")
Me.ContextualMenu = menu

The menu selection is then handled by the ContextualMenuSelected event when the user right-clicks on the control. For example, it can be of the form:

Select case hitItem.Value
Case "One"
  MessageBox("One")
Case "Two"
  MessageBox("Two")
Case "Three"
  MessageBox("Three")
End Select

WebTabPanel.ControlID

ControlID As String

Identifies the control on a per session basis.

This property is read-only.


WebTabPanel.Enabled

Enabled As Boolean

When True the WebControl is drawn enabled and responds to user action. When False, the control appears as disabled and does not respond to user actions.

In the case of WebTimer, when set to False this disables and stops the WebTimer. When set to True, it starts the WebTimer.

Disable a button when a check box value changes:

If AllowSaveCheckBox.Value Then
  SaveButton.Enabled = True
Else
  AllowSaveButton.Enabled = False
End If

WebTabPanel.HasBorder

HasBorder As Boolean

When True the WebTabPanel is drawn with left, right and bottom borders.


WebTabPanel.Height

Height As Integer

The height (in pixels) of the control.


WebTabPanel.Indicator

Indicator As Indicators

The color scheme for the control.

When a WebButton's Default or Cancel properties are True, the Indictor property is ignored as Default and Cancel buttons have a default indicator.


WebTabPanel.LastControlIndex

LastControlIndex As Integer

The index of the last WebControl on the WebView.


WebTabPanel.LayoutDirection

LayoutDirection As LayoutDirections

The direction in which WebContainer controls will flow when added at runtime to a layout whose LayoutType is set to Flex.


WebTabPanel.LayoutType

LayoutType As WebView.LayoutTypes

The type of layout dictates whether controls are positioned at fixed locations or can move to accommodate changes to the bounds of the WebView, in the latter case, only for WebContainer controls that are added at runtime to a layout whose type is set to Flex.


WebTabPanel.Left

Left As Integer

The position of the left side of the WebUIControl in pixels, relative to the web page.


WebTabPanel.LockBottom

LockBottom As Boolean

Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning web page.

This property is read-only.


WebTabPanel.LockHorizontal

LockHorizontal As Boolean

LockHorizontal overrides LockLeft and LockRight. It allows you to proportionally lock a control's position to the center of its parent control (or web page).

This property is read-only.

For example, if you place a control in the center of the page and sets both LockHorizontal and LockVertical, the control will stay in the center of the page.


WebTabPanel.LockLeft

LockLeft As Boolean

Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning web page.

This property is read-only.


WebTabPanel.LockRight

LockRight As Boolean

Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning web page.

This property is read-only.


WebTabPanel.LockVertical

LockVertical As Boolean

LockVertical overrides LockTop and LockBottom. It allows you to proportionally lock a control's position to keep it centered within the parent control or web page.

This property is read-only.

For example, if you place a control in the center of the page, and sets both LockHorizontal and LockVertical, the control will stay in the center of the page.


WebTabPanel.Name

Name As String

The name of the control.

This property is read-only.


WebTabPanel.Page

Page As WebPage

Identifies the web page that contains the control.

This property is read-only.


WebTabPanel.PanelCount

PanelCount As Integer

Gets the number of panels in the WebPagePanel.

This property is read-only.

Me.Value = PagePanel1.PanelCount.ToString

WebTabPanel.Parent

Parent As WebControl

Used to get the control's parent control or page. If the parent control is a WebContainer, then it returns the WebContainer. If it is on a WebPage, it returns the WebPage.

This property is read-only.


WebTabPanel.SelectedPanelIndex

SelectedPanelIndex As Integer

The number of the currently selected panel.

To change the panel that is displayed, set this value. Modifying this value calls the PanelChanged event.

This is also how you change the displayed panel for the WebTabPanel control, which is subclassed from WebPagePanel.

This example uses a WebPopupMenu in a WebPagePanel to navigate to another panel. The example uses the selected item on the WebPopupMenu as the panel in the WebPagePanel to display.

PagePanel1.SelectedPanelIndex = PopupMenu1.SelectedRowIndex

WebTabPanel.Style

Style As WebStyle

The WebStyle for the control.

In the Pressed event of a WebButton, set the text to bold:

Var style As New WebStyle
style.Bold = True
Me.Style = style

WebTabPanel.TabIndex

TabIndex As Integer

The WebUIControl's control's position in the Tab Order. The control with a TabIndex of 0 is the first WebUIControl to get the focus when the page opens in the browser.

This example sets the control's TabIndex.

Me.TabIndex = 2

WebTabPanel.Tooltip

Tooltip As String

Text of a message displayed as a tooltip.

The tip is displayed when the user places the mouse on the control and leaves it there.

This code in the Shown event of a Button sets the tooltip:

Me.Tooltip = "Save changes"

WebTabPanel.Top

Top As Integer

The top of the control in local coordinates relative to the web page.


WebTabPanel.Visible

Visible As Boolean

If True, the control is drawn. If False, it's not.

Hide a control based on a checkbox setting:

If ShowEmailCheckbox.Value Then
  EmailField.Visible = True
Else
  EmailField.Visible = False
End If

WebTabPanel.Width

Width As Integer

The width (in pixels) of the web control.

This code in the Shown event handler increases the size of the control:

Me.Width = Me.Width + 50

Method descriptions


WebTabPanel.AddControl

AddControl(Child As WebControl)

Adds the passed Control to the WebView.

This code adds a WebTextField to the page:

Var tf As New WebTextField
tf.Left = 100
tf.Top = 50
tf.Enabled = True
Self.AddControl(tf)

WebTabPanel.Close

Close

Removes the control from the page.


WebTabPanel.ControlAt

ControlAt(Index As Integer) As WebControl

Returns the WebControl at the index passed.


WebTabPanel.ExecuteJavaScript

ExecuteJavaScript(Script As String)

Executes the JavaScript passed. The JavaScript passed can call a JavaScript function in a WebPageSource control.

The Xojo web framework uses EcmaScript 6 which is more strict than previous versions of JavaScript. For more details, see the EcmaScript 6 documentation.

This code in the Pressed event of a Button displays an alert using JavaScript:

Me.ExecuteJavaScript("alert('Hello!');")

This code will select the text in a WebTextField (or WebTextArea):

WebTextField1.ExecuteJavascript("document.getElementById('" + _
  WebTextField1.ControlID + "_inner').select();")

WebTabPanel.GotoURL

GotoURL(Url As String, inNewWindow As Boolean = False)

Opens the passed URL in place of the current web page or downloads a file. If InNewWindow is True, the browser is asked to open the URL in a new window.

If the browser has popup windows disabled and InNewWindow is True, the method silently fails and the page is not shown.

If InNewWindow is False, the running web app is replaced with the specified URL. If you want to display an external web site within your web app, use the WebHTMLViewer control.

Display a web site in a new popup window:

Me.GotoURL("http://www.wikipedia.org", True)

WebTabPanel.LastPanelIndex

LastPanelIndex(index As Integer)

The index number of the last panel.


WebTabPanel.SetFocus

SetFocus

Sets the focus to the Control.

This code checks for a required value when a button is pressed:

If UserNameField.Value = "" Then
  MessageBox("Please enter your UserName.")
  UserNameField.SetFocus
  Return
End If

WebTabPanel.UpdateBrowser

UpdateBrowser

Forces the current values of the control to be sent to the browser.

This method is useful when you are computing values in a loop and wish to update the browser immediately rather than wait until the current method ends.

This code iterates through a RowSet of database rows, updates a ProgressBar and then forces the updated ProgressBar to be sent to the browser via UpdateBrowser.

ProgressBar1.Maximum = SalesData.RowCount
For Each row As DatabaseRow in SalesData
 AnalyzeSales(row)
 ProgressBar1.Value = ProgressBar1.Value + 1
 ProgressBar1.UpdateBrowser
Next

Event descriptions


WebTabPanel.Closed

Closed

The control has been removed from the browser either because the page has closed or the control's Close method was called.


WebTabPanel.ContextualMenuSelected

ContextualMenuSelected(hitItem As WebMenuItem)

Called when a contextual menu item is selected. This selected item is contained in hitItem.

This code populates a contextual menu in the Opening event of a WebToolbar:

Var menu As New WebMenuItem

menu.AddMenuItem("One")
menu.AddMenuItem("Two")
menu.AddMenuItem("Three")
Me.ContextualMenu = menu

The menu selection is then handled by the ContextualMenuSelected event when the user right-clicks on the control. For example, it can be of the form:

Select case hitItem.Value
Case "One"
  MessageBox("One")
Case "Two"
  MessageBox("Two")
Case "Three"
  MessageBox("Three")
End Select

WebTabPanel.Hidden

Hidden

The control is about to become no longer visible. This could be because the page is being closed, is being replaced as the foreground page by another page or because the control or a parent control's Visible property has been set to False.

Note

This event is equivalent to the DesktopWindow.Deactivated event in a desktop app.


WebTabPanel.Opening

Opening

The control has been created and the page is opening but has not been sent to the browser yet.

The Opening event handler can be used to initialize non-visual properties and settings for controls.

In most cases, you should use the Shown event to initialize controls.


WebTabPanel.Overflowed

Overflowed(width As Integer, height As Integer)

The area (in pixels) by which WebContainers have overflowed the bounds of a WebView whose LayoutType is set to Flex.


WebTabPanel.PanelChanged

PanelChanged

The frontmost page has changed and can be determined using the SelectedPanelIndex property.

This is also called when the user changes the selected tab in a WebTabPanel.


WebTabPanel.Resized

Resized

The WebView has been resized either because the user resized the browser window or the WebView was resized at runtime via code.


WebTabPanel.Shown

Shown

The control has appeared on the currently displayed page. This could be because its parent page just finished loading, its parent page has come to the foreground or the control is now visible having been previously invisible because it or its parent control's Visible property has been set to True.

Use the Shown event for initializing your controls or doing anything that would interact with other controls or user interface elements on the web page instead of the Opening event.

Note

This event is the web equivalent to the DesktopWindow.Activated event.

This code in the Shown event of a WebListBox adds 2 rows with 3 columns:

Me.RemoveAllRows
Me.AddRow("Row 1", "Bob", "Roberts")
Me.AddRow("Row 2", "Barb", "Reynolds")

This example sets the text of a label:

If Session.LoggedIn Then
  Me.Value = "Welcome!"
Else
  Me.Value = "Welcome, " + Session.UserName
End If

Notes

Getting and setting the displayed panel

Use the SelectedPanelIndex property to get and set the tab panel being displayed. The PanelCount property gives you the number of panels in the WebTabPanel as it is a subclass of WebPagePanel.

The following line of code moves a ListBox from its current panel to the second panel of a WebTabPanel.

ListBox1.PanelIndex = 1

Adding, labelling, and renaming tabs

In the Inspector, click the value of the Panels property of the TabPanel to display the Tab Panel editor. From this dialog box, you can:

  • Rename the existing tab labels by clicking twice on its name and editing the name.

  • Add tabs and their labels by clicking the Add button.

  • Delete any tab by highlighting it and clicking Delete.

  • Rearrange the tabs by highlighting a tab and clicking the Up or Down buttons.

You add controls to a particular panel by clicking its tab and dragging controls to that panel.


Placing controls on tab panels

You can place other controls on the surface of any tab panel. Such controls are visible only when the user clicks on that panel's tab to bring it to the front.

Placing WebTabPanels within a WebPagePanel (and vice versa) are not supported.

If the CaptionAt property contains an ampersand character, it will display only if it is preceded by another ampersand character. This is done to make applications on all platforms behave consistently. The ampersand character is used to indicate the keyboard accelerator on Windows.

Controls placed on TabPanels are referenced in your code just by using the control name as if it were not on a TabPanel:

PushButton1.Caption = "OK"

Warning

Embedding a WebTabPanel into another WebTabPanel or into a WebPagePanel is not supported.

Compatibility

Web projects on all supported operating systems.

See also

WebPagePanel parent class; WebPagePanel control.