Purpose of the article
- Share your software development experience using wxWidgets.
- Share ready-made solution in the preparation and printing of document templates.
- Get recommendations and constructive criticism on the functional.
But first story
So, once, working at one of the industrial enterprises, which had its own equipment for the commercial accounting of oil, with its software solutions under different operating systems, more and more often began to think about cross-platform software development.
I sipped then different libraries. Gtk + and QT were on the list. But really, I got attracted by wxWidgets.
At the same time, I had a private database project for a company that was involved in supporting car purchase transactions, insurance, maintenance. I did it on weekends. At the initial stage of this project, I tried QT, Gtk +, wxWidgets, but in the end I completely re-implemented it with the help of other tools, because:
Patience is an excellent quality, but life is too short to endure for a long time - Abu-l-Faraj.
At that time, the reason for not using these libraries was the time limit, not the complexity of the technical implementation. Business does not like to wait.
In general, during the development of this project for each library I tested, I reached a certain level of completion. The table shows the results in ascending order.
Tool | What was done | Feedback from the customer | Rejection reason |
---|
QT | A couple of forms + binding them with logic. | Not submitted to the customer. | Spent a lot of time searching for solutions. |
Gtk + | Whole GUI. | For WinXP GUI did not look like a native and familiar. | There was a lack of a GUI builder integrated into the IDE. Not the usual GUI view. Bulkiness of implementation, long names of functions. Spent a lot of time searching for solutions. |
wxWidgets | Entire GUI + DB. | There was no printing of documents with precise positioning of the elements. | There was no ready-made document template generator for printing. |
There were others, but their results are even more modest than those of QT.
')
To be fair, it must be said that this was the first experience of using all these libraries. If it were not for the generator of document templates for printing in wxWidgets ...
Now what?
As a result, quite recently, I made a minimally viable cross-platform template generator and client library for printing using wxWidgets at the level I would have had then.
Those who want to try can take here:
c-help.tk . The site was kindly provided to me by my brother, I asked him to draw up as simply as possible and without frills. I hope we did it.
What we have at the moment:
- Template generator under Windows, Linux.
- Client library under Windows, Linux with an example.
- An example of a client using this library under Windows, Linux.
- Site for promotion.
What does this look like?
Template generator:

The simplest client (console application on the left):

How it works?
Template generator:
1. A certain template is created in which the graphic elements are precisely located, as in the technical drawing.
2. An enumeration of variable names is created.
3. In the right places of the templates are text boxes.
4. In the text fields, you can enter static text along with the variable names. The variable is specified between the special characters "$ {" and "} $" (for now only manually).
5. The template is saved to a file. There may be many templates in the file. Image files are not attached to the template. The client for printing gives only pictures in the BMP format.
Client + client library:
6. Loads the template file.
7. Selects the template (currently only through the index).
8. Sets data into variables (currently only through an index).
9. Issues to print. Printing may cause an offset due to different printer margin settings.
Conclusion
What was used:
- Development environment Code :: Blocks 13.12.
- wxWidgets 3.0.2.
- MinGW 3.4.5 compiler for Windows for the project and compilation of wxWidgets (gcc for Linux).
- Windows 8.
- Linux Mint 17.2.
- Doxygen to form a description of the client library.
- Git
- TUT for unit tests.
- GDB 7.6.1 for debugging.
What pleased in wxWidgets:
- The wxSmith plugin in Code :: Blocks helps to build a GUI in a graphical editor mode, which has greatly reduced the time it takes to generate code.
- So far I have not had to rewrite a single line of code to compile for Linux. I hope this will continue.
- Fully accessible detailed documentation.
- The wxWidgets license allows you to create applications for all supported platforms under different licenses based on your library.
- Application internationalization (GNU gettext).
- PropertyGrid out of the box.
What is not very pleased with wxWidgets:
- GDB did not display, for example, the value of the wxString string classes when debugging. It did not help the configuration of the debugger, as advised in the forums. It's sad. Although in previous versions of Code :: Blocks, it seems to me that this data was displayed without corrections. I had to draw the output of string variables to the log file and look at the values that were written in it. As a bonus, the user logging functionality was received (disabled in the release), which is also useful.
- The wxWidgets libraries are initialized implicitly and automatically in a macro when using the GUI application created in Code :: Blocks. A description of the manual initialization method, although presented in the documentation, is a simple call to the wxInitialize () function, but it is described very poorly.
I think that without automating many things in Code :: Blocks, using wxWidgets would be more difficult.
That's all for now.