Mercurial > projects > dynamin
changeset 48:41b141453b8e
Fix crash in RadioButton.whenKeyDown()
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Tue, 04 Aug 2009 20:31:15 -0500 |
parents | 41b76c218851 |
children | 62742ce025ec |
files | dynamin/gui/radio_button.d |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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);