Skip to content Skip to sidebar Skip to footer

Tag: Articles

Taking Screenshots with wxWidgets under Mac OS is Really Tricky.

Taking screenshots is a very common task and it was a must for one of my current projects. What was a surprise when I understood that my favourite toolkit can't do that in cross-platform manner. It is official bug that wxScreenDC does not work properly under Mac OS and you can't use Blit() message for copying screen onto wxMemoryDC. After digging the Internet I found a kind of solution which used OpenGL and created wxWidgets-based class which takes screenshots also under Mac OS. It was really hard task for me because I haven't used neither Carbon nor Cocoa before. However everything works now and I'm happy. Here it is:

Read more

How to Create Nice About Box in wxWidgets

After taking a look at wxWidgets samples I noticed that all of them have simple message box instaed of normal about box. However in real applications About dialog is important enough part of GUI. So, in this post I'm going to tell a bit about creating About boxes for your software. wxWidgets has builf-in API for creating "standard" dialog boxes. wxAboutBox() function is used for displaying About box and wxAboutDialogInfo object, which contains all necessary information, should be passed to wxAboutBox() function.

Read more

Getting Acquainted with Document/View Framework – Simple Image Viewer

In my previous posts here and here I showed how to create a simple application which uses Document/View framework. Now I’m going to show more complex example – image viewer with scrolling and selection rectangle. As far as I can see from wxForum, implementation of selection-related functionality is some kind of complex but very useful task. So, let’s start from simple part. The simplest task here is modification of our wxDocument-related class.

Read more

Getting Acquainted with Document-View architecture – Part II – Simple Text Editor

Today we’ll dig a little bit deeper into Document/View framework provided by wxWidgets and will see how to create a simple text editor using this framework. We’ll take the source code from the previous article of this series and add some modifications. You will see below that modifications are rather simple and take almost no time. First of all we have to make wxDocTemplate to handle desired file extensions (in our case it’s TXT).

Read more

wxJSON Tutorial – Part IV – Using Comment Lines in wxJSON

Preface

Here is a fourth part of wxJSON tutorial provided by Luciano Cattani, author and maintainer of wxJSON library.

Using Comment Lines in wxJSON

Comments are not supported by the JSON syntax specifications but many JSON implementations do recognize and store comment lines in the JSON value objects. Starting by version 0.2, the wxJSON library do recognize and store C/C++ comment lines in the JSON input text and can also write comments to the JSON output text.

Read more

wxJSON Tutorial – Part III – Describing a Table

Preface

Here is a third part of wxJSON tutorial provided by Luciano Cattani, author and maintainer of wxJSON library.

Describing a Table with wxJSON

How many times did you use a table in your application? I know the answer: many times. So the best thing would be to write a general-purpose panel window that is capable to show every possible table and table's format.

Read more

wxJSON Tutorial – Part II – Сonfiguration File

Preface

Here is a second part of wxJSON tutorial provided by Luciano Cattani, author and maintainer of wxJSON library.

Creating a Configuration File with wxJSON

We start by using JSON for an application's configuration file. There are many formats for storing application's configuration data. I remember when there was MS-DOS: each application used its own, unreadable and proprietary format (it was a nightmare). Next came Windows 3: it had a better way for storing application's configuration data; they were kept in an .INI file which contains simple ASCII text. This was a good thing because it was easier for humans to fine-tuning application's behaviour. In this example we use JSON to store the configuration data of a simple web server application. If you take a look at the Apache config file you will notice that our example looks very similar (but much more human readable).

Read more