A good number of the samples I have tested are outright or subtly broken on Windows now. I''m trying to determine what the cause is. Mostly it seems related to the initialize function not being created when it should be. Case in point: ClientDC.i The caret example won''t work at all because initialize isn''t declared any longer. If you comment out the import lines, Swig does create an initialize. For ClientDC this fixes things so you can at least allocate one. Second case: Choice.i This is missing an %import for wxControlWithItems. However, if you add this, the constructor goes away. It''s too hot in my house with the air conditioner out for me to attempt to puzzle this out later. If cooler heads haven''t figured this out later I may revisit it. Roy
Roy Sutton wrote:> A good number of the samples I have tested are outright or subtly broken > on Windows now.Argh! You''re right. wxruby2 is pretty thoroughly broken at the moment. The problem has to do with pure virtual functions and abstract base classes.> Case in point: ClientDC.iRight. It inherits from WindowDC which inherits from DC. DC itself is/should be abstract because it has a large number of pure virtual functions. After quite a bit of research, though, and experimentation, I think I see the answer: 1. Insert the word "virtual" at the beginning of each pure virtual method declaration. I don''t think swig actually cares, but it''s the right thing to do. 2. Stop generating directors for any abstract base class. Fortunately, there only seem to be 8 of these, and I''ve already done one of them (DC). 3. ARGH: In any concrete subclass of an abstract base class, wherever the pure virtuals are actually defined, add those definitions to the .h files. This is ugly because it means updating MOST of the Event classes, MANY of the DC classes, ALL of the Sizer classes, and MOST of the classes that inherit from ControlWithItems. It''s also a pain because I either have to guess where each method is defined, or examine each real wx .h file. Having "fixed" WindowDC, the caret sample works again. So at least there is hope again.> It''s too hot in my house with the air > conditioner out for me to attempt to puzzle this out later. If cooler > heads haven''t figured this out later I may revisit it.You have my sympathies, especially if you''re someplace really hot like me (Florida). Fortunately, my A/C is working fine, so my cool brain was functioning up to spec tonight. Thanks, Kevin
Kevin Smith
2005-Aug-21 23:53 UTC
[Wxruby-users] No longer completely broken (was: New inheritance)
Kevin Smith wrote:> > Argh! You''re right. wxruby2 is pretty thoroughly broken at the moment. > > After quite a bit of research, though, and experimentation, I think I > see the answer: > > 1. Insert the word "virtual" at the beginning of each pure virtual > method declaration. I don''t think swig actually cares, but it''s the > right thing to do.Done (I think).> 2. Stop generating directors for any abstract base class. Fortunately, > there only seem to be 8 of these, and I''ve already done one of them (DC).Done (I think).> 3. ARGH: In any concrete subclass of an abstract base class, wherever > the pure virtuals are actually defined, add those definitions to the .h > files. This is ugly because it means updating MOST of the Event classes, > MANY of the DC classes, ALL of the Sizer classes, and MOST of the > classes that inherit from ControlWithItems. It''s also a pain because I > either have to guess where each method is defined, or examine each real > wx .h file.Done (I think). At this point, wxruby2 is again able to run the samples that I tried (that it ran before). So I think it is "unbroken" again. I have tagged this as 0.0.28. Kevin
Didn''t test against this latest checkin but just in case you missed it here''s a patched wxRadioBox.h Kevin Smith wrote:> Kevin Smith wrote: > >> >> Argh! You''re right. wxruby2 is pretty thoroughly broken at the moment. >> >> After quite a bit of research, though, and experimentation, I think I >> see the answer: >> >> 1. Insert the word "virtual" at the beginning of each pure virtual >> method declaration. I don''t think swig actually cares, but it''s the >> right thing to do. > > > Done (I think). > >> 2. Stop generating directors for any abstract base class. >> Fortunately, there only seem to be 8 of these, and I''ve already done >> one of them (DC). > > > Done (I think). > >> 3. ARGH: In any concrete subclass of an abstract base class, wherever >> the pure virtuals are actually defined, add those definitions to the >> .h files. This is ugly because it means updating MOST of the Event >> classes, MANY of the DC classes, ALL of the Sizer classes, and MOST >> of the classes that inherit from ControlWithItems. It''s also a pain >> because I either have to guess where each method is defined, or >> examine each real wx .h file. > > > Done (I think). > > At this point, wxruby2 is again able to run the samples that I tried > (that it ran before). So I think it is "unbroken" again. I have tagged > this as 0.0.28. > > Kevin > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >-------------- next part -------------- --- wxruby2_new/swig/classes/include/wxRadioBox.h 2005-01-30 22:18:52.000000000 -0500 +++ wxruby2/swig/classes/include/wxRadioBox.h 2005-08-22 00:08:53.334144000 -0400 @@ -56,7 +56,7 @@ * \param bool */ - void Enable(bool enable = true) ; + virtual bool Enable(bool enable = true) ; /** * \brief Enables or disables an individual button in the radiobox. @@ -74,7 +74,7 @@ * \param bool */ - void Enable(int n , bool enable = true) ; + virtual bool Enable(int n , bool enable = true) ; /** * \brief Finds a button matching the given string, returning the position if found, or -1 if not found. @@ -86,7 +86,11 @@ * \brief Returns the number of items in the radiobox. */ - int GetCount() const; + virtual int GetCount() const; + + virtual int GetColumnCount() const; + virtual int GetRowCount() const; + /** * \brief Returns the radiobox label. */ @@ -102,7 +106,7 @@ * \brief Returns the zero-based position of the selected button. */ - int GetSelection() const; + virtual int GetSelection() const; /** * \brief Returns the selected string. */ @@ -149,14 +153,14 @@ * \param int */ - void SetSelection(int n ) ; + virtual void SetSelection(int n ) ; /** * \brief Sets the selection to a button by passing the desired string. This does not cause a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted. * \param const wxString& */ - void SetStringSelection(const wxString& string ) ; + virtual void SetStringSelection(const wxString& string ) ; /** * \brief Shows or hides the entire radiobox. * \param const bool @@ -180,13 +184,13 @@ * \param const bool */ - void Show(int item , const bool show ) ; + virtual void Show(int item , const bool show = true ) ; /** * \brief Returns the label for the button at the given position. * \param int */ - wxString GetString(int n ) const; + virtual wxString GetString(int n ) const; };
Sean Long
2005-Aug-22 01:37 UTC
[Wxruby-users] No longer completely broken (was: New inheritance)
Just checked it out and it compiles fine on OS X but when the samples are run no windows are shown. I will look into it a bit to see if anything obvious jumps out at me. Sean On 8/21/05, Kevin Smith <wxruby@qualitycode.com> wrote:> Kevin Smith wrote: > > > > Argh! You''re right. wxruby2 is pretty thoroughly broken at the moment. > > > > After quite a bit of research, though, and experimentation, I think I > > see the answer: > > > > 1. Insert the word "virtual" at the beginning of each pure virtual > > method declaration. I don''t think swig actually cares, but it''s the > > right thing to do. > > Done (I think). > > > 2. Stop generating directors for any abstract base class. Fortunately, > > there only seem to be 8 of these, and I''ve already done one of them (DC). > > Done (I think). > > > 3. ARGH: In any concrete subclass of an abstract base class, wherever > > the pure virtuals are actually defined, add those definitions to the .h > > files. This is ugly because it means updating MOST of the Event classes, > > MANY of the DC classes, ALL of the Sizer classes, and MOST of the > > classes that inherit from ControlWithItems. It''s also a pain because I > > either have to guess where each method is defined, or examine each real > > wx .h file. > > Done (I think). > > At this point, wxruby2 is again able to run the samples that I tried > (that it ran before). So I think it is "unbroken" again. I have tagged > this as 0.0.28. > > Kevin > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >
Sean Long
2005-Aug-24 10:34 UTC
[Wxruby-users] No longer completely broken (was: New inheritance)
I still have not gotten the OS X version working completely. I have found that Dialog based windows work just fine it is Frame based ones that are not displaying. Kevin and Roy do you remember changing anything durring the inheritance overhaul that would affect this? I only see this problem on OS X it runs fine on Windows. Sean On 8/21/05, Sean Long <sean.m.long@gmail.com> wrote:> Just checked it out and it compiles fine on OS X but when the samples > are run no windows are shown. I will look into it a bit to see if > anything obvious jumps out at me. > > Sean > > On 8/21/05, Kevin Smith <wxruby@qualitycode.com> wrote: > > Kevin Smith wrote: > > > > > > Argh! You''re right. wxruby2 is pretty thoroughly broken at the moment. > > > > > > After quite a bit of research, though, and experimentation, I think I > > > see the answer: > > > > > > 1. Insert the word "virtual" at the beginning of each pure virtual > > > method declaration. I don''t think swig actually cares, but it''s the > > > right thing to do. > > > > Done (I think). > > > > > 2. Stop generating directors for any abstract base class. Fortunately, > > > there only seem to be 8 of these, and I''ve already done one of them (DC). > > > > Done (I think). > > > > > 3. ARGH: In any concrete subclass of an abstract base class, wherever > > > the pure virtuals are actually defined, add those definitions to the .h > > > files. This is ugly because it means updating MOST of the Event classes, > > > MANY of the DC classes, ALL of the Sizer classes, and MOST of the > > > classes that inherit from ControlWithItems. It''s also a pain because I > > > either have to guess where each method is defined, or examine each real > > > wx .h file. > > > > Done (I think). > > > > At this point, wxruby2 is again able to run the samples that I tried > > (that it ran before). So I think it is "unbroken" again. I have tagged > > this as 0.0.28. > > > > Kevin > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > >
Sean, Before I corrected some of the inheritance problems the windows would not open on Windows either. I didn''t investigate it exactly as the problems were pretty widespread at first. It could be some issue still related to the inheritance. You might want to compare the Mac vs. Windows tree. Roy Sean Long wrote:>I still have not gotten the OS X version working completely. I have >found that Dialog based windows work just fine it is Frame based ones >that are not displaying. > >Kevin and Roy do you remember changing anything durring the >inheritance overhaul that would affect this? I only see this problem >on OS X it runs fine on Windows. > >Sean > >On 8/21/05, Sean Long <sean.m.long@gmail.com> wrote: > > >>Just checked it out and it compiles fine on OS X but when the samples >>are run no windows are shown. I will look into it a bit to see if >>anything obvious jumps out at me. >> >>Sean >> >>On 8/21/05, Kevin Smith <wxruby@qualitycode.com> wrote: >> >> >>>Kevin Smith wrote: >>> >>> >>>>Argh! You''re right. wxruby2 is pretty thoroughly broken at the moment. >>>> >>>>After quite a bit of research, though, and experimentation, I think I >>>>see the answer: >>>> >>>>1. Insert the word "virtual" at the beginning of each pure virtual >>>>method declaration. I don''t think swig actually cares, but it''s the >>>>right thing to do. >>>> >>>> >>>Done (I think). >>> >>> >>> >>>>2. Stop generating directors for any abstract base class. Fortunately, >>>>there only seem to be 8 of these, and I''ve already done one of them (DC). >>>> >>>> >>>Done (I think). >>> >>> >>> >>>>3. ARGH: In any concrete subclass of an abstract base class, wherever >>>>the pure virtuals are actually defined, add those definitions to the .h >>>>files. This is ugly because it means updating MOST of the Event classes, >>>>MANY of the DC classes, ALL of the Sizer classes, and MOST of the >>>>classes that inherit from ControlWithItems. It''s also a pain because I >>>>either have to guess where each method is defined, or examine each real >>>>wx .h file. >>>> >>>> >>>Done (I think). >>> >>>At this point, wxruby2 is again able to run the samples that I tried >>>(that it ran before). So I think it is "unbroken" again. I have tagged >>>this as 0.0.28. >>> >>>Kevin >>>_______________________________________________ >>>wxruby-users mailing list >>>wxruby-users@rubyforge.org >>>http://rubyforge.org/mailman/listinfo/wxruby-users >>> >>> >>> > >_______________________________________________ >wxruby-users mailing list >wxruby-users@rubyforge.org >http://rubyforge.org/mailman/listinfo/wxruby-users > > > > >
Kevin Smith
2005-Aug-24 19:35 UTC
[Wxruby-users] RadioBox changes (was No longer completely broken)
Roy Sutton wrote:> Didn''t test against this latest checkin but just in case you missed it > here''s a patched wxRadioBox.hI had to work with this a while before it would compile for me. I ended up removing GetColumns and GetRows because they don''t exist on my system, and aren''t in the wx docs. I also had to split Show into Show and ShowItem, like wxPython has. Hopefully what I did will still work on the other platforms. By the way, my earlier pass was to catch all the pure virtual methods, not all the virtual methods. There are probably quite a few other methods that should be marked virtual but still aren''t. Kevin
Sean Long wrote:> I still have not gotten the OS X version working completely. I have > found that Dialog based windows work just fine it is Frame based ones > that are not displaying. > > Kevin and Roy do you remember changing anything durring the > inheritance overhaul that would affect this? I only see this problem > on OS X it runs fine on Windows.Ugh. No, I don''t remember anything specific. I did have a somewhat similar problem though, where the new bigdemo sample just would not show its main window, even though the code looked fine. Minimal and nothing did come up, though. So I copied their app code over piece by piece until the new bigdemo code started working. I still couldn''t see what was different between the working code and the non-working code. To try to debug it, I inserted several printfs directly into App.cpp, to try to figure out what was happening. In my case, the window was being created, but for some reason was not being recognized by wx as being "the" top window, and therefore as soon as the mainloop was entered, wx exited because it thought the top window didn''t exist. Best guess: the inheritance changes have caused some virtual method to not get called that used to be called, or vice versa. Or (as Roy hinted) that the parentage under Mac is different enough from Linux and Windows to cause problems. One would think that the issue would be with Frame. Just to confirm: Even samples/minimal/nothing.rb doesn''t come up? Kevin
> To try to debug it, I inserted several printfs directly into App.cpp, to > try to figure out what was happening. In my case, the window was being > created, but for some reason was not being recognized by wx as being > "the" top window, and therefore as soon as the mainloop was entered, wx > exited because it thought the top window didn''t exist.Will have to try that, thanks.> Just to confirm: Even samples/minimal/nothing.rb doesn''t come up?Nope, does not show a Frame. Sean
I finally got Frames working again in OS X, I am not sure why it worked but it does. I had to remove %import "include/wxTopLevelWindow.h" from Frame.i I am not sure if this should have #ifndef __WXMAC__ around it or not, can someone test it on another platform? I can test it on Windows tomorrow. Sean On 8/24/05, Sean Long <sean.m.long@gmail.com> wrote:> > To try to debug it, I inserted several printfs directly into App.cpp, to > > try to figure out what was happening. In my case, the window was being > > created, but for some reason was not being recognized by wx as being > > "the" top window, and therefore as soon as the mainloop was entered, wx > > exited because it thought the top window didn''t exist. > > Will have to try that, thanks. > > > > Just to confirm: Even samples/minimal/nothing.rb doesn''t come up? > > Nope, does not show a Frame. > > Sean >-------------- next part -------------- A non-text attachment was scrubbed... Name: frame.patch Type: application/octet-stream Size: 515 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050828/e3cd40ec/frame.obj
Kevin Smith
2005-Aug-29 08:46 UTC
[Wxruby-users] Frame/TopLevelWindow problems on Mac (was: No longer completely broken)
Sean Long wrote:> I finally got Frames working again in OS X, I am not sure why it > worked but it does. I had to removeThat''s great news.> > %import "include/wxTopLevelWindow.h" > > from Frame.iBut I don''t like that solution. It not only removes virtual-ness from all the TopLevelWindow methods in Frame, but it also cuts out all the Window, EvtHandler, and Object virtuals. If we are going to cut out TopLevel entirely, the proper way to do it would be to change wxFrame.h to declare: class wxFrame : public wxWindow With that change, it should still work on Mac. Can you test that? If not, then we know the problem isn''t actually in TopLevelWindow, but in one of the classes higher in the inheritance chain. If we confirm that the problem is in TopLevelWindow, it''s quite possible that we wouldn''t have to remove it entirely. The two most likely virtual methods in TopLevelWindow that might be causing problems are IsActive and IsTopLevel. So the next thing to try would be to restore the wxTopLevelWindow parentage in wxFrame.h, and then #if out just those two methods from wxTopLevelWindow.h. You can check src/Frame.h to confirm that those methods no longer appear as virtuals. Thanks! Kevin
Sean Long
2005-Aug-29 10:29 UTC
[Wxruby-users] Frame/TopLevelWindow problems on Mac (was: No longer completely broken)
> class wxFrame : public wxWindow > > With that change, it should still work on Mac. Can you test that? If > not, then we know the problem isn''t actually in TopLevelWindow, but in > one of the classes higher in the inheritance chain.Just tried inheriting from wxWindow and it does not work. Which makes sense because this problem existed before I added wxTopLevelWindow to wxruby2. Any ideas on where to go from here? Sean
Sean Long wrote:>>class wxFrame : public wxWindow >> >>With that change, it should still work on Mac. Can you test that? If >>not, then we know the problem isn''t actually in TopLevelWindow, but in >>one of the classes higher in the inheritance chain. > > > Just tried inheriting from wxWindow and it does not work. Which makes > sense because this problem existed before I added wxTopLevelWindow to > wxruby2. > > Any ideas on where to go from here?Oh. Try inheriting from wxEvtHandler then. If that doesn''t work, try inheriting from wxObject. We want to try to isolate which exact method(s) are causing problems when virtualized on the Mac. Thanks, Kevin
I got it to work. I had to add: bool Show(bool show = true); to wxFrame.h the code for Show(bool show) in src/wxFrame.cpp looks like this without the Show signature added to wxFrame: bool SwigDirector_wxFrame::Show(bool show) { VALUE obj0 = Qnil ; bool c_result ; VALUE result; if (swig_get_up()) { return wxWindow::Show(show); } obj0 = show ? Qtrue : Qfalse; result = rb_funcall(swig_get_self(), rb_intern("show"), 1,obj0); c_result = (bool) RTEST(result); return (bool) c_result; } and like this with the signature added: bool SwigDirector_wxFrame::Show(bool show) { VALUE obj0 = Qnil ; bool c_result ; VALUE result; if (swig_get_up()) { return wxFrame::Show(show); } obj0 = show ? Qtrue : Qfalse; result = rb_funcall(swig_get_self(), rb_intern("show"), 1,obj0); c_result = (bool) RTEST(result); return (bool) c_result; } Comparing the wxWidgets headers for MSW and Mac I can not see where this would make a difference, but it obviously does in the case of the Mac. I am not going to submit a patch, if you think it is an appropriate fix I will let you make the change. Sean On 8/29/05, Kevin Smith <wxruby@qualitycode.com> wrote:> Sean Long wrote: > >>class wxFrame : public wxWindow > >> > >>With that change, it should still work on Mac. Can you test that? If > >>not, then we know the problem isn''t actually in TopLevelWindow, but in > >>one of the classes higher in the inheritance chain. > > > > > > Just tried inheriting from wxWindow and it does not work. Which makes > > sense because this problem existed before I added wxTopLevelWindow to > > wxruby2. > > > > Any ideas on where to go from here? > > Oh. Try inheriting from wxEvtHandler then. If that doesn''t work, try > inheriting from wxObject. We want to try to isolate which exact > method(s) are causing problems when virtualized on the Mac. > > Thanks, > > Kevin > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >
Ah! Good catch! We will probably find a few other cases like this, where the wx docs don''t mention that classes are actually overriding methods defined in their superclasses. Most likely, wxFrame::Show is what sets the wx top window, so it makes sense that if we are directly invoking wxWindow::Show (and therefore bypassing wxFrame::Show), it wouldn''t work properly. Committed. Thanks! Kevin Sean Long wrote:> I got it to work. I had to add: > bool Show(bool show = true); > > to wxFrame.h > > the code for Show(bool show) in src/wxFrame.cpp looks like this > without the Show signature added to wxFrame: > > bool SwigDirector_wxFrame::Show(bool show) { > VALUE obj0 = Qnil ; > bool c_result ; > VALUE result; > > if (swig_get_up()) { > return wxWindow::Show(show); > } > obj0 = show ? Qtrue : Qfalse; > result = rb_funcall(swig_get_self(), rb_intern("show"), 1,obj0); > c_result = (bool) RTEST(result); > return (bool) c_result; > } > > and like this with the signature added: > > bool SwigDirector_wxFrame::Show(bool show) { > VALUE obj0 = Qnil ; > bool c_result ; > VALUE result; > > if (swig_get_up()) { > return wxFrame::Show(show); > } > obj0 = show ? Qtrue : Qfalse; > result = rb_funcall(swig_get_self(), rb_intern("show"), 1,obj0); > c_result = (bool) RTEST(result); > return (bool) c_result; > } > > Comparing the wxWidgets headers for MSW and Mac I can not see where > this would make a difference, but it obviously does in the case of the > Mac. > > I am not going to submit a patch, if you think it is an appropriate > fix I will let you make the change. > > Sean