ControlAddItem appears not to update index.
Issue #72
closed
Test code:
MyGui := Gui()
; ┌─────────────┐
; │ Combo Box │
; └─────────────┘
ThirdText4 := MyGui.Add("Text", "x10 cBlue", "ComboBox")
MyCB := MyGui.Add("ComboBox", "x10 y+10 r10 -Limit", ["Orange","Purple","Fuchsia","Lime","Aqua"])
CB_Button := MyGui.Add("Button", "x10 y+10", "Show CB Selection")
CB_AddBtn := MyGui.Add("Button", "x140 yp", "Add 'Yellow' to CB")
CB_Button.OnEvent("Click", "CB_ButtonClicked")
CB_AddBtn.OnEvent("Click", "AddYellow")
MyGui.Show()
AddYellow() {
ControlAddItem("Yellow", MyCB)
}
; ┌─────────────────────┐
; │ ComboBox Callback │
; └─────────────────────┘
CB_ButtonClicked() {
MsgBox(MyCB.Text, "CB Selection")
}
This is not a new bug, I didn’t test guitest.ahk thoroughly enough.
Clicking “Add ‘Yellow’ to CB” does add the item to the ComboBox, but then selecting it throws an unhandled exception. If you click ‘Continue’, the selection does appear in the Edit.
In case that’s not legible, the error message says: “InvalidArgument=Value of ‘5' is not valid for ‘index’. (Parameter 'index’)
Actual value was 5”
???
Comments (4)
-
repo owner -
reporter Resolved, thank you! Closing.
-
reporter - changed status to resolved
Resolved.
-
reporter - changed status to closed
Closed.
- Log in to comment
I’ve committed a fix, please test.