Original email follows, see <http://rubyforge.org/pipermail/wxruby-users/2011-July/005901.html>. Alex Fenton's
follow-up has a brief description of ways to solve the problm. I favor fiddling with SWIG to translate Ruby return
values to C++ booleans in the expected way.
I'm working on enabling/disabling controls, and I keep getting
exceptions like the following:
mysource.rb:262:in `enable': Expected argument 1 of type bool, but got
NilClass nil (TypeError)
in SWIG method 'Enable'
from mysource.rb:262
from
C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classe
s/app.rb:16:in `call'
from
C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classe
s/app.rb:16:in `process_event'
from
C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classe
s/app.rb:16:in `on_run'
from
C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classe
s/app.rb:16:in `main_loop'
from
C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classe
s/app.rb:16:in `run'
from app.rb:188
Is there an (easy) way to help WxRuby follow Ruby's notion of truth,
i.e. everything but +nil+ and +false+ are true?
The current best workaround I have is
enable(... ? true : false)
but that's clunky, and I obviously keep forgetting to use it. |