MENU: EasyUO 1.5 and 1.6
EasyUO has two different menu systems, and EasyUO Reforged runs both. Each script runs under one of them,
the 1.5 logic or the 1.6 logic, chosen when the script starts.
Why there are two
Section titled “Why there are two”- EasyUO 1.5 is the version whose source code was published. Its
menubuilds one window with controls in it. Reforged is a port of that source, so this is themenumost scripts were written for. - EasyUO 1.6 came later, around 2017, as closed builds. Its author rewrote
menu: any number of windows (menu Form), containers (menu Panel), radio buttons, and reading and changing any property of any control (menu GetProp,menu SetProp). The rewrite also changed how the old sub-commands behave in places: names,#MenuButton, what happens when a script starts.
Neither is a superset of the other. A script written for 1.6 shows nothing under 1.5, and some scripts written for 1.5 misbehave under 1.6. Reforged’s 1.6 logic is a port of what EasyUO 1.6.0.337 does, checked against the real program; the few places where it differs on purpose are on Known limitations.
How Reforged picks one
Section titled “How Reforged picks one”When a stopped script starts, Reforged reads its text once:
- A
menu Reforge Modeline decides:1.5or1.6. - Otherwise, a
menuline using any of the nine sub-commands only 1.6 has selects the 1.6 logic:Form,Panel,Radio,GetProp,SetProp,GetDef,SetDef,PushDefandPopDef. - Otherwise, the 1.5 logic.
menu Form main 300 200 260 50 My tool ; 1.6-only: this script runs under the 1.6 logicmenu Text t 10 10 Built with menu Form.menu SetProp main visible #truehaltmenu Clearmenu Text status 10 10 Waiting... ; only sub-commands both have: the 1.5 logicmenu ShowhaltOnly real menu lines count: a sub-command in a comment does not, and neither does one that comes from a
variable (menu %what ...), which is only known once the line runs. Files the script pulls in with
call are not read, unless the script says
menu Reforge IncludeCall #true.
The editor’s status bar shows which logic the script runs, or ran last: MENU 1.5, MENU 1.6, or
MENU 1.6 (forced) when menu Reforge Mode chose it. If a 1.6-only sub-command does run under a 1.5 logic
that was chosen for you, Reforged says so once per run, in a message box, and tells you which line to add.
The script keeps running; under 1.5 that line does nothing.
Choosing it yourself
Section titled “Choosing it yourself”Put a menu Reforge Mode line in the main script, usually at the top:
menu Reforge Mode 1.6set %make Formset %change SetPropmenu %make main 300 200 260 50 Chosen by menu Reforge Modemenu Text t 10 10 Form and SetProp come from variables.menu %change main visible #truehaltIt is read before the script runs, wherever it is, so it works even in a script whose 1.6 sub-commands all
come from variables or from called files. The value must be written as 1.5 or 1.6; a variable is not
read. EasyUO 1.5 and 1.6 themselves ignore the line, so a script that has it still runs there.
menu Reforge IncludeCall #true makes the automatic choice read
the files the script calls too.
The MENU Designer writes 1.6 windows only, and every file it saves starts with
menu Reforge Mode 1.6.
One logic for the whole run
Section titled “One logic for the whole run”The choice holds for the whole run, for the main script and every file it calls, as in EasyUO, where one version ran everything. The two logics cannot be mixed: a window built by one is unknown to the other. To change logic, stop the script and start it again; the windows of the old logic are taken down first.
Which sub-commands each has
Section titled “Which sub-commands each has”Differs links to how the sub-command behaves differently in the two.
| Sub-command | 1.5 | 1.6 | |
|---|---|---|---|
| menu Activate | ✓ | ✓ | Differs |
| menu Button | ✓ | ✓ | Differs |
| menu Check | ✓ | ✓ | Differs |
| menu Clear | ✓ | ✓ | Differs |
| menu Combo (Create, Add, Select, Clear) | ✓ | ✓ | Differs |
| menu Delete | ✓ | ✓ | Differs |
| menu Edit | ✓ | ✓ | Differs |
| menu Font Align, BgColor, Color, Name, Size, Style | ✓ | ✓ | |
| menu Font Transparent | ✓ | ignored by 1.6 | |
| menu Form | ✓ | ||
| menu Get | ✓ | ✓ | Differs |
| menu GetDef | ✓ | ||
| menu GetNum | ✓ | ✓ | Differs |
| menu GetProp | ✓ | ||
| menu Hide | ✓ | ✓ | Differs |
| menu HideEUO | ✓ | ignored by 1.6 | |
| menu Image Create | ✓ | ✓ | Differs |
| menu Image Ellipse, Line, Rectangle | ✓ | ✓ | Differs |
| menu Image File, FloodFill, Pix | ✓ | ✓ | |
| menu Image PixLine | ✓ | ignored by 1.6 | |
| menu Image Pos | ✓ | ✓ | Differs |
| menu List (Create, Add, Select, Clear) | ✓ | ✓ | Differs |
| menu Memo (Reforged) | ✓ | ✓ | Differs |
| menu Panel | ✓ | ||
| menu PopDef, menu PushDef | ✓ | ||
| menu Radio | ✓ | ||
| menu Reforge Mode, IncludeCall (Reforged) | ✓ | ✓ | |
| menu Set | ✓ | ✓ | Differs |
| menu SetDef | ✓ | ||
| menu SetProp | ✓ | ||
| menu Shape | ✓ | ✓ | Differs |
| menu Show | ✓ | ✓ | Differs |
| menu Text | ✓ | ✓ | Differs |
| menu Window Color, Size, Title, Transparent | ✓ | ✓ |
The differences in detail
Section titled “The differences in detail”- 1.5: several controls may share a name.
menu Set,menu Delete,combo/listAdd,SelectandClear, and themenu Imagedrawing commands act on all of them;menu Getandmenu Activateuse the first. - 1.6: a name belongs to one control. A second control created with a taken name still appears, but no
command can reach it:
menu Setchanges the first,menu Deleteremoves only the first, and a click on the second button records nothing. Names are not case-sensitive and are kept in lower case.
menu Clearmenu Window Size 200 70menu Text status 10 10 onemenu Text status 10 30 twomenu Set status three ; 1.5: both labels say "three". 1.6: only the first does.menu Showhalt#MenuButton and #MenuRes
Section titled “#MenuButton and #MenuRes”| 1.5 | 1.6 | |
|---|---|---|
| A button click | the button’s name in capitals | the button’s name in lower case |
| The window’s × | CLOSED |
CLOSED for the main window; another menu Form gives its own name |
menu Hide |
CLOSED |
unchanged |
menu Clear |
unchanged | emptied |
| A script starting | unchanged: the last run’s value | #MenuButton and #MenuRes emptied |
In 1.6, set #MenuButton form0 reads back as CLOSED.
Starting and stopping
Section titled “Starting and stopping”- 1.5: starting a script frees its controls but leaves the window as it was, shown or hidden.
- 1.6: starting a script destroys every menu window, then creates a new, hidden main window at 100,100 with a 305 × 180 inside.
Stopping a script leaves every window as it is in both.
The main window
Section titled “The main window”In 1.6 the main window is a control called form0: menu GetProp and
menu SetProp work on it, menu SetDef parent form0 puts new controls back in
it, and menu Delete form0 destroys it until the next start. It has a fixed frame without a maximize button.
In 1.5 it is a resizable window that no command can name.
Shapes
Section titled “Shapes”In 1.5 menu Shape is a real shape: dashed lines, hatched fills, rounded
corners. In 1.6 it is drawn into an image: the line is solid or absent, the inside is filled only with fill
type 7, rounded corners are square, and types 1, 5 and 6 shrink the box to a centred square. Because it is
an image, menu Image commands can draw on it.
Labels and the removed sub-commands
Section titled “Labels and the removed sub-commands”1.6 ignores menu Font Transparent: its labels always have a
background, in the colour set by menu Font BgColor. It also ignores
menu HideEUO and menu Image PixLine.
Checks on numbers
Section titled “Checks on numbers”1.6 refuses a negative width or height in menu Image Create and
menu Shape, and a negative second corner in menu Image Line, Ellipse and
Rectangle. An invalid line width draws a 1-pixel line in 1.6 and nothing in 1.5.
Other sub-commands
Section titled “Other sub-commands”menu Activateworks on any control in 1.6 and brings its window to the front.menu Getandmenu Setalso work on radio buttons in 1.6.menu Image Posmoves any control in 1.6, and stretches an image only when a size is given.menu Showalso puts the window on top in 1.6.
Moving a script from 1.5 to 1.6
Section titled “Moving a script from 1.5 to 1.6”- Give every control its own name, at least those the script changes, reads or deletes later.
- Set
#MenuButtontoN/Abefore waiting for a click. (Its case changes, fromOKtook, but=ignores case.) - Don’t wait for
CLOSEDaftermenu Hide: in 1.6 hiding is silent. - Instead of
menu Font Transparent, give labels the colour of what is behind them. - Check shapes that use dashed lines, hatching or rounded corners.
- Add
menu Reforge Mode 1.6at the top, so Reforged does not depend on detecting it.
Moving a script from 1.6 to 1.5
Section titled “Moving a script from 1.6 to 1.5”The nine 1.6-only sub-commands do nothing in 1.5. Build a single window with
menu Window and menu Show instead of forms, place
controls directly instead of in panels, use check boxes instead of radio buttons, and read values with
menu Get instead of menu GetProp.
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.