Table of Contents

Class Menu

Namespace
SampSharp.Entities.SAMP
Assembly
SampSharp.OpenMp.Entities.dll

Represents a component which provides the data and functionality of a menu.

public class Menu : IdProvider
Inheritance
Menu
Inherited Members

Constructors

Menu(IMenusComponent, IMenu, string)

Initializes a new instance of the Menu class.

protected Menu(IMenusComponent menus, IMenu menu, string title)

Parameters

menus IMenusComponent
menu IMenu
title string

Properties

Col0Header

Gets or sets the header text of the left column in this menu.

public virtual string Col0Header { get; set; }

Property Value

string

Col0RowCount

Gets the number of rows in the left column of this menu.

public virtual int Col0RowCount { get; }

Property Value

int

Col0Width

Gets the width of the left column in this menu.

public virtual float Col0Width { get; }

Property Value

float

Col1Header

Gets or sets the header text of the right column in this menu.

public virtual string Col1Header { get; set; }

Property Value

string

Col1RowCount

Gets the number of rows in the right column of this menu.

public virtual int Col1RowCount { get; }

Property Value

int

Col1Width

Gets the width of the right column in this menu.

public virtual float Col1Width { get; }

Property Value

float

Columns

Gets the number of columns in this menu.

public virtual int Columns { get; }

Property Value

int

IsEnabled

Gets a value indicating whether this menu accepts input.

public virtual bool IsEnabled { get; }

Property Value

bool

IsOmpEntityDestroyed

Gets a value indicating whether the open.mp entity counterpart has been destroyed.

protected bool IsOmpEntityDestroyed { get; }

Property Value

bool

Position

Gets the position of this menu.

public virtual Vector2 Position { get; }

Property Value

Vector2

Title

Gets the title of this menu.

public virtual string Title { get; }

Property Value

string

Methods

AddItem(string, string?)

Adds an item to this menu.

public virtual int AddItem(string col0Text, string? col1Text = null)

Parameters

col0Text string

The text for the left column.

col1Text string

The text for the right column. If this menu only has one column, this parameter is ignored.

Returns

int

The index of the row this item was added to.

Remarks

A maximum of 12 items can be displayed per menu (the 13th appears to the right of the column header, and items beyond that are not displayed). The maximum length of a menu item is 31 characters.

Disable()

Disables input for this menu, preventing any items from being selected.

public virtual void Disable()

DisableRow(int)

Disables a specific row in this menu for all players. The row will be grayed out and cannot be selected.

public virtual void DisableRow(int row)

Parameters

row int

The index of the row to disable.

GetCell(int, int)

Gets the text of a specific menu cell.

public virtual string? GetCell(int row, int column)

Parameters

row int

The row index.

column int

The column index.

Returns

string

The cell text, or null if no cell exists at the given coordinates.

Hide(Player)

Hides this menu for the specified player.

public virtual void Hide(Player player)

Parameters

player Player

The player to hide this menu from.

IsRowEnabled(int)

Checks whether the specified menu row is selectable.

public virtual bool IsRowEnabled(int row)

Parameters

row int

The row index.

Returns

bool

true if enabled; otherwise false.

OnDestroyComponent()

This method is invoked before this component is destroyed and removed from its entity.

protected override void OnDestroyComponent()

Show(Player)

Shows this menu for the specified player.

public virtual void Show(Player player)

Parameters

player Player

The player to show this menu to.

ToString()

public override string ToString()

Returns

string

Operators

implicit operator IMenu(Menu?)

Performs an implicit conversion from Menu to IMenu.

public static implicit operator IMenu(Menu? menu)

Parameters

menu Menu

Returns

IMenu