Show / Hide Table of Contents

Method toolbar.Menu(+ 1 overload)


Overload

Adds button with drop-down menu.

public TBItem Menu(string text, Action<popupMenu> menu, MTImage image = default, int l_ = 0, string f_ = null)
Parameters
text  (string)

Text. Or "Text|Tooltip", or "|Tooltip", or "Text|". Separator can be "|" or "\0 " (then "|" isn't a separator). To always display text regardless of toolbar.DisplayText, append "\a", like "Text\a" or "Text\a|Tooltip".

menu  (Action<popupMenu>)

Action that adds menu items. Called whenever the button clicked.

image  (MTImage)

Image. Read here: MTBase.

l_  (int)

Caller info parameter

f_  (string)

Caller info parameter

Returns
TBItem

Remarks

The submenu is a popupMenu object. It inherits these properties of this toolbar: MTBase.ExtractIconPathFromCode, MTBase.ActionException, MTBase.ActionThread, MTBase.PathInTooltip.

Examples

tb.Menu("Menu", m => {
	m["M1"]=o=>print.it(o);
	m["M2"]=o=>print.it(o);
});

Overload(top)

Adds button with drop-down menu.

public TBItem Menu(string text, Func<popupMenu> menu, MTImage image = default, int l_ = 0, string f_ = null)
Parameters
text  (string)

Text. Or "Text|Tooltip", or "|Tooltip", or "Text|". Separator can be "|" or "\0 " (then "|" isn't a separator). To always display text regardless of toolbar.DisplayText, append "\a", like "Text\a" or "Text\a|Tooltip".

menu  (Func<popupMenu>)

Func that returns the menu. Called whenever the button clicked.

image  (MTImage)

Image. Read here: MTBase.

l_  (int)

Caller info parameter

f_  (string)

Caller info parameter

Returns
TBItem

Remarks

The caller creates the menu (creates the popupMenu object and adds items) and can reuse it many times. Other overload does not allow to create popupMenu and reuse same object. The submenu does not inherit properties of this toolbar.

Examples

var m = new popupMenu(); m.AddCheck("C1"); m.AddCheck("C2");
t.Menu("Menu", () => m);