From Xojo Documentation

Property (As Variant )
aWebMenuItem.Tag = newVariantValue
VariantValue = aWebMenuItem.Tag

New in 2011r2

Supported for all project types and targets.

A hidden value associated with the menu item.


The tag is accessible via code when the user chooses the menu item but, unlike the Text property, is not displayed in the menu. It works like the RowTag property of a PopupMenu control.

The Tag is a variant so it can contain any value, including class references.


This code displays a menu when you right-click on a Label. This code is in the Shown event handler of a WebLabel:

Var file As New WebFile
file.MimeType = "text/plain"
file.ForceDownload = True // If False, the browser may try to display the file instead of download it
file.FileName = "TextFile.txt"
file.Data = "Hello, world!"

Var base As New WebMenuItem

Var downloadMenu As New WebMenuItem("Download")
downloadMenu.Tag = file // The file to download

Me.ContextualMenu = base

In the ContextualMenuAction event handler of the WebLabel, you can then use the tag to download the previously created file:

If Item.Text = "Download" Then
Var file As WebFile = Item.Tag
End If