After more consideration, checking the code, reading both versions of the documentation, and checking your script again, I conclude that this is not a bug, but the documentation is a little unclear.
Your scripts are not equivalent. The options in v1 and v2 are not equivalent and are not intended to be equivalent.
The Background option is described very differently between the two versions.
v1 wrote:-Background (i.e. minus Background): Uses the standard background color rather than the one set by the Gui Color command. [...] Use GuiControl +Background to remove this option later.
v2 wrote:BackgroundColor: Changes the background color of the control.
In v1, the option is a simple on/off switch. The option doesn't accept a color value (for Edit controls), doesn't store a color value, and whatever you do with it can't affect the GUI's
ControlColor because that's obviously a property of the GUI, not the control.
There is no
ControlColor in v2, but there is BackColor, which is a combination of
WindowColor and
ControlColor.
If this option is not present, a Text, [and some other types but not Edit] control initially defaults to the background color set by Gui.BackColor (or if none or other control type, the system's default background color). Specifying BackgroundDefault or -Background applies the system's default background color. For example, a control can be restored to the default color via LV.Opt("+BackgroundDefault"). Using +Background without specifying a color reverts -Background.
This demonstrates what it means by "reverts -Background":
Code: Select all
#Requires AutoHotkey v2.0
MyGui := Gui()
MyGui.BackColor := "Blue"
MyGui.Add("text", "vEdt w200 h100", "abcdefg")
MyGui["Edt"].Opt("-Background") ; Use system default, not MyGui.BackColor
MyGui["Edt"].Opt("+Background") ; Use MyGui's default (MyGui.BackColor)
MyGui.Show()
It does not - and is not intended to - revert the option to a previous value that same option had. It is roughly equivalent with the v1 behaviour. The differences are:
- WindowColor and ControlColor are merged into one property (BackColor).
- Instead of merely setting "use the system default" or "use the GUI's color", you can set "use blue (or whatever color)".
I might change the documentation as follows:
BackgroundColor: Changes the background color of the control. Replace Color with a color name (see color chart) or RGB value (the 0x prefix is optional). Examples: BackgroundSilver, BackgroundFFDD99. If this option is not presentused, or if +Background is used with no suffix, a Text, Picture, GroupBox, CheckBox, Radio, Slider, Tab or Link control initially defaults touses the background color set by Gui.BackColor (or if none or other control type, the system's default background color). Specifying BackgroundDefault or -Background applies the system's default background color. For example, a control can be restored to the system default color via LV.Opt("+BackgroundDefault"). Using +Background without specifying a color reverts -Background. If a control type does not support this option, an error is thrown.