Class

MobileContainer


Description

A MobileContainer is a way to create a group of controls that are treated as a single control. It is a great way to simplify complex screens. In addition, with MobileContainer, you can create reusable controls to include on multiple screens or even other MobileContainers.

Events

Name

Parameters

Returns

AppearanceChanged

dark As Boolean

Closing

Opening

Property descriptions


MobileContainer.AccessibilityHint

AccessibilityHint As String

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

Me.AccessibilityHint = "Click to calculate the value and display the next screen."

MobileContainer.AccessibilityLabel

AccessibilityLabel As String

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

Me.AccessibilityLabel = "Calculate the value."

MobileContainer.ControlCount

ControlCount As Integer

The number of child controls in the control.

This property is read-only.

Important

This property is supported for iOS only.


MobileContainer.Enabled

Enabled As Boolean

Indicates whether the control is enabled or disabled.

Disable the button:

Button1.Enabled = False

MobileContainer.Height

Height As Integer

The height of the control.

This property is read-only on iOS.


MobileContainer.Left

Left As Integer

The left position of the control.

This property is read-only on iOS.


MobileContainer.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 screen.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockBottom = True

MobileContainer.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 screen.

LockLeft and Locktop default to True when you add a new control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockLeft has no effect unless LockRight is True.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockLeft = True

MobileContainer.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 screen.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockRight = True

MobileContainer.LockTop

LockTop As Boolean

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

LockTop and LockLeft default to True when you add a control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockTop has no effect unless LockBottom is True.

Important

This property is not currently supported for iOS. Use constraints instead.

This property can be set in the control's Inspector. The following example sets it in code.

Me.LockTop = True

MobileContainer.Name

Name As String

The name of the control.

This property is read-only.


MobileContainer.Parent

Parent As MobileUIControl

The parent (sometimes called a "Super") class of the control.

This property is read-only.


MobileContainer.TintColor

TintColor As ColorGroup

Changes a control's tint color.

Important

This is supported for iOS only.

On iOS, the following controls support TintColor:

Enum

Description

ProgressBar

The area indicating the value of the control will be drawn in the TintColor.

Slider

The area indicating the value of the control will be drawn in the TintColor.

TextArea

The cursor and text highlight color will be drawn in the TintColor.

TextField

The cursor and text highlight color will be drawn in the TintColor.


MobileContainer.Top

Top As Integer

The top position of the control.

This property is read-only on iOS.


MobileContainer.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

MobileContainer.Width

Width As Integer

The width of the control.

This property is read-only on iOS.

Method descriptions


MobileContainer.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

Adds a constraint to the control.

This constraint is used by child controls that have been added to this control.

Important

This is supported for iOS only.


MobileContainer.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.


MobileContainer.ClearFocus

ClearFocus

Removes the focus from the control.

TextField1.ClearFocus

MobileContainer.ControlAt

ControlAt(index As Integer) As MobileUIControl

Gets the child control at the specified index.


MobileContainer.Controls

Controls As Iterable

Allows you to iterate through all the controls that have been added to this control.

Note

This does not include non-control object instances. For that, use the Objects method.


MobileContainer.Handle

Handle As Ptr

The handle to the underlying native OS control.


MobileContainer.Objects

Objects As Iterable

Allows you to iterate through all the non-control object instances on the container.

Note

This does not include controls. For that, use the Controls method.


MobileContainer.Refresh

Refresh

Marks the control so that it will be redrawn during the next event loop.

Call Refresh to force a Canvas to redraw itself:

Canvas1.Refresh

MobileContainer.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.

Important

This is supported for iOS only.


MobileContainer.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.


MobileContainer.SetFocus

SetFocus

Sets the focus to the control.

TextField1.SetFocus

Mobilecontainer.ShowPopover

ShowPopover(parentControl As MobileToolbarButton, animated As Boolean = True)

Displays the container as a popover below the parentControl.

Important

This method is not currently supported for Android.


ShowPopover(parentControl As MobileUIControl, animated As Boolean = True)

Displays the container as a popover on top of the parentControl's screen.

The animated parameter is supported for iOS only.

This example from a button's Pressed event displays the container named MyPopover:

Var c As New MyPopover
c.ShowPopover(Me)

Note

You may have to add constraints via code before calling this method so that the container will resize to fill the popover.

Important

This method is not currently supported for Android.

Event descriptions


MobileContainer.AppearanceChanged

AppearanceChanged(dark As Boolean)

Called when a user switches between Light and Dark mode.

Use this event to update any graphics or other UI as needed.

Important

This is supported for iOS only.


MobileContainer.Closing

Closing

Called when the control's layout is closing.


MobileContainer.Opening

Opening

Called when the control's layout is opening.

This is where you typically put initialization code.

This example in the Opening event of a label sets its text to "Hello":

Me.Text = "Hello"

Compatibility

Mobile projects on all supported mobile operating systems.

See also

MobileUIControl parent class; MobileScreen class, MobileScrollableArea control