noreply at rubyforge.org
2011-Jul-06 20:22 UTC
[wxruby-development] [ wxruby-Feature Requests-29306 ] Tweak SWIG to match Ruby''s notion of truth
Feature Requests item #29306, was opened at 2011-07-06 14:22 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=221&aid=29306&group_id=35 Category: API improvement Group: User request Status: Open Priority: 3 Submitted By: Ryan Hinton (iobass) Assigned to: Alex Fenton (brokentoy) Summary: Tweak SWIG to match Ruby''s notion of truth Initial Comment: 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. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=221&aid=29306&group_id=35