LINQPad 9 Bug - MultiSelectListBox - set SelectBox.SelectedIndexes doesn't work
In LINQPad9, methods for selecting multiple options in SelectBox with MultiSelectListBox kind doesn't works.
The code delays for a few seconds on the line with calling methods sbx.SelectedIndexes or sbx.SelectedOptions and the options are not set.
(Sometimes at this line the debugger hangs)
The code for reproduce bug:
string[] opts = Enumerable.Range(0, 32) .Select(e => Math.Pow(2, e).ToString()) .ToArray(); int[] selIdxs = new[] { 3, 5, 6 }; object[] selOpts = new object[] { "4", "16", "32" }; SelectBox sbx = new SelectBox(opts); sbx.Kind = SelectBoxKind.MultiSelectListBox; sbx.SelectedIndexes = selIdxs; //sbx.SelectedOptions = selOpts; sbx.Dump();
Comments
-
The problem is that the act of setting the indexes/options is just sending a javascript command to the results panel and not merely setting a property on the object. It won't work if the item isn't already dumped. It will work if you move it after the dump.
There should be a way to make it so setting these properties prior to being dumped would defer the command until after it is dumped. Kinda like a "pre-dump script" for any changes.
There are other issues if you were to dump the same object multiple times but that's a different issue.
-
That's right: At the moment, it works only if you Dump the control first.
I'll fix this bug in this week's LINQPad 9 build.