# HG changeset patch # User Jordan Miner # Date 1249435875 18000 # Node ID 41b141453b8e18d271ff1c32d3a11e8d6ca71996 # Parent 41b76c218851b72ea967256bc62f09987c907238 Fix crash in RadioButton.whenKeyDown() diff -r 41b76c218851 -r 41b141453b8e dynamin/gui/radio_button.d --- a/dynamin/gui/radio_button.d Tue Aug 04 20:28:18 2009 -0500 +++ b/dynamin/gui/radio_button.d Tue Aug 04 20:31:15 2009 -0500 @@ -66,17 +66,23 @@ // TODO: when GetTopLevel() is changed to return NativeControl, // update this int index; - RadioButton[] radios = collectGroup(index); - if(radios is null) - return; if(e.key == Key.Down || e.key == Key.Right) { + RadioButton[] radios = collectGroup(index); + if(radios is null) + return; if(++index >= radios.length) index = 0; + radios[index].clicked(new EventArgs); + e.stopped = true; } else if(e.key == Key.Up || e.key == Key.Left) { + RadioButton[] radios = collectGroup(index); + if(radios is null) + return; if(--index < 0) index = radios.length-1; + radios[index].clicked(new EventArgs); + e.stopped = true; } - radios[index].clicked(new EventArgs); } override void whenPainting(PaintingEventArgs e) { Theme.current.RadioButton_paint(this, e.graphics);