Skip to content

menu Button

menu Button {name} {x} {y} {width} {height} {text}

Also searchable as: menu Button

menu Button places a button in the menu window. Clicking it puts the button’s name in #MenuButton.

Parameter Meaning
name The control’s name, used later by menu Get, menu Set and menu Delete. Case does not matter. This is what #MenuButton holds after a click, in capital letters.
x, y Position of the top-left corner.
width, height Size in pixels.
text The caption on the button.

It uses the current font settings.

#MenuButton keeps the last click until something else is clicked, so clear it before you wait. Comparisons ignore case, so ok matches OK:

menu Clear
menu Window Size 160 100
menu Text ask 10 10 Go on?
menu Button ok 10 60 60 25 OK
menu Button cancel 80 60 60 25 Cancel
menu Show
set #MenuButton N/A
while #MenuButton = N/A
wait 1
if #MenuButton = cancel || #MenuButton = closed
display ok Cancelled.
else
display ok Going on.
halt

Change the caption later with menu Set.

  • 1.5: a click puts the button’s name in #MenuButton in capitals (OK).
  • 1.6: the name is in lower case (ok); = ignores case, so if #MenuButton = ok works in both. The button goes into the current default parent, and a second button created with a name already taken appears but does nothing when clicked. See MENU: EasyUO 1.5 and 1.6.

See also

Based on the EasyUO wiki, edited for EasyUO Reforged. This text is available under the GNU Free Documentation License 1.2.

The EasyUO 1.6 behaviour on this page was researched with help from the ScriptUO community: Gaderian's tutorial New Menu Code and how to adapt old scripts and the scripts its members share at scriptuo.com.