Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadioButton change event fires on off-on transition only #91

Open
jimfoltz opened this issue Mar 9, 2014 · 3 comments
Open

RadioButton change event fires on off-on transition only #91

jimfoltz opened this issue Mar 9, 2014 · 3 comments

Comments

@jimfoltz
Copy link
Contributor

jimfoltz commented Mar 9, 2014

Not sure if by design, but RadioButton :change event only was getting fired from off-on transition, and not on-off.

@thomthom thomthom added the bug label Mar 9, 2014
@thomthom
Copy link
Owner

thomthom commented Mar 9, 2014

Hmm... that doesn't sound right. Do you have a short sample?

@jimfoltz
Copy link
Contributor Author

jimfoltz commented Mar 9, 2014

unless defined?(SKUI::Window)
  load 'C:\Users\Jim\Documents\GitHub\@jimfoltz\SKUI\src\SKUI\core.rb'
end

w = SKUI::Window.new

g = SKUI::Groupbox.new('Group Box')
g.right = 5
g.left = 5
g.height = 100
w.add_control( g )


r = SKUI::RadioButton.new( 'Radio' ) { puts 'World! :)' }
r.on(:change) {|ctrl| puts "r changed." }
r.top = 25
r.width = 200
g.add_control( r )

r2 = SKUI::RadioButton.new( 'Radio2' ) { puts 'World! :)' }
r2.on(:change) {|ctrl| puts "r2 changed." }
r2.top = 45 
r2.width = 200
g.add_control( r2 )

b = SKUI::Button.new('Push') {
  p r
  p r.properties
  p r.checked?
  p r2
  p r2.properties
  p r2.checked?
}
b.top = 75

w.add_control( b )
w.show

@thomthom
Copy link
Owner

thomthom commented Mar 9, 2014

Hm...this appear to be by design - not by me - but by the DOM events of the HTML radioboxes...
http://stackoverflow.com/a/5176900/486990

Gotta think this one through - you'd think there was a reason why they did it like that. I guess the assumption is that you should be listening to all the radioboxes in the group - when one changes you know the rest also changes. Maybe it's to avoid too many events firing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants