Swig is making mincemeat out of ComboBox.new. Because of the way it''s picking the ''correct'' one to call it''s calling with a null name instead of a default name. How did we fix this before?
Kevin Smith
2005-Sep-15 13:38 UTC
[Wxruby-users] ComboBox.new optional parameter handling (was: Swig hates us...)
Roy Sutton wrote:> Swig is making mincemeat out of ComboBox.new. Because of the way it''s > picking the ''correct'' one to call it''s calling with a null name instead > of a default name. How did we fix this before?In the other case, the ArrayInt (or ArrayString) version of the constructor was used in all cases where there were a potentially confusing number of parameters. Can you show a sample call to ComboBox.new that generates the wrong result? It''s usually easier for me to deal with questions like this when I have a specific example to analyze/debug. Thanks, Kevin
Well, any of the bigdemo samples that include the ComboBox. I think that''s wxComboBox.rbw and wxToolBar.rbw. The problem with the arrayString version is there''re no default parameters, IIRC. Kevin Smith wrote:> Roy Sutton wrote: > >> Swig is making mincemeat out of ComboBox.new. Because of the way it''s >> picking the ''correct'' one to call it''s calling with a null name instead >> of a default name. How did we fix this before? >> > > In the other case, the ArrayInt (or ArrayString) version of the > constructor was used in all cases where there were a potentially > confusing number of parameters. > > Can you show a sample call to ComboBox.new that generates the wrong > result? It''s usually easier for me to deal with questions like this when > I have a specific example to analyze/debug. > > Thanks, > > Kevin > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > >
Roy Sutton wrote:>>>Swig is making mincemeat out of ComboBox.new. Because of the way it''s >>>picking the ''correct'' one to call it''s calling with a null name instead >>>of a default name. How did we fix this before?Ok. The solution here is (in classes/include/wxComboBox.h) to comment out the constructor that doesn''t use ArrayString, and then to add the default values for all the parameters before it. I would also insert a comment above this constructor saying something like: // tweak this signature so it can be used // for cases where only a few parameters are passed Basically, we are fooling the system. Invocations with so few parameters that the int/char** vs ArrayString distinction doesn''t matter will be treated as if they were calls to the ArrayString constructor. But the actual code generated will actually call the other constructor, because it will match the signature. I tried this, and it compiled and ran. I also had to tweak the bigdemo ComboBox code to not call append with two strings. But I haven''t checked any of this in, because mine was all just a quick hack, and I trust you can do a better job with it. Same with the directorout stuff, by the way. I experimented with it to see it work, but I don''t plan to check in any of that. Ongoing thanks for your efforts, Kevin