LoadPicture is not working or syntax unknown
Issue #24
closed
This AHK code works.
MyGui := Gui(, "KEYSHARP TESTS")
Handle := LoadPicture(A_ScriptDir "\monkey.ico")
MyGui.Add("Picture", "w30 h30 x10 y+10" , A_ScriptDir "\monkey.ico")
MyButton := MyGui.Add("Button", , "Get monkey icon handle")
MyButton.OnEvent("Click", ExposeMonkey)
MyGui.Show()
ExposeMonkey(*) {
MsgBox(Handle)
}
Tried modifying this code to expect a Map/Dictionary:
MyGui := Gui(, "KEYSHARP TESTS")
Handle := LoadPicture(A_ScriptDir "\monkey.ico")
MyGui.Add("Picture", "w30 h30 x10 y+10" , A_ScriptDir "\monkey.ico")
MyButton := MyGui.Add("Button", , "Get monkey icon handle")
MyButton.OnEvent("Click", "ExposeMonkey")
MyGui.Show()
ExposeMonkey() {
MsgBox(Handle["ImageType"])
}
And got this error:
Uncaught Keysharp exception:
Message: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Reference is to Keysharp.Core\Common\ImageHelper.cs at line 75.
Comments (6)
-
reporter -
reporter Update: Fix seems only to require
// var icon = int.MinValue; int icon = 0;
-
repo owner Your fix was correct. I’ve committed it, so please test.
-
reporter Tested, please mark as resolved and close. Thanks!
-
repo owner - changed status to resolved
-
repo owner - changed status to closed
- Log in to comment
Suggested fix. Compiles and runs correctly with suggested fix. Starts at line 17 of Keysharp.Core\Core\Images.cs.
This gets rid of the negative index error.
Keysharp code that works after fix.