The Power of Open Source

I’m just giving the finishing touches to my wxWidgets + SQLite + CppUnit personal project, all written in standard C++, and compiling in Mac, Windows and Linux as well. And I had the opportunity to see how good is to be able to change the source code of a library when you need it.

The problem was that the wxCalendarCtrl control that comes with wxWidgets 2.6.3 (see note below) did not render properly on Windows. In all the other platforms it looked OK, but in Windows it just looked like this:

As you can see, the wxSpinCtrl used to change the years is next to unusable. I looked around the API documentation to see if there was some method to change that width, but it turns out that there is not such thing.

But… since wxWidgets is open-source, I just opened the src\generic\calctrl.cpp file and looked inside to see how the whole thing was built: I found that the size of the spinner depends on that of the months wxComboBox control, and then what I did is just to force the size of the combo box to a fixed size of 100 pixels, instead of the default value “wxDefaultCoord” (I did the change in line 275, in the constructor of the wxComboBox called “m_comboMonth”).

I rebuilt the library, and then I rebuilt my own project linking to the patched code:

VoilĂ ! No need to dig into proprietary support website that seldom bring an answer, or to wait for a service pack or patch or anything else that will correct the thing. With open source software, I can just go and fix things myself, whenever I need it. And for free.

Note: By the way, I’m using version 2.6.3 since I want the code to compile under Mac OS X 10.2 “Jaguar” as well (as far as I saw, 2.7 is not compatible with Jaguar any more). I will post more screenshots, as well as the whole source code, very soon!