Showing posts with label wxWidgets. Show all posts
Showing posts with label wxWidgets. Show all posts

Wednesday, July 6, 2022

Friday, February 28, 2020

Working with JSON in C++

In this article, using JsonCpp library and wxJson library to work with JSON (JavaScript Object Notation) in C++ is discussed.


JsonCpp

A convenient way to use JsonCpp is adding its amalgamated source. At first, get the source from the official repository,

https://github.com/open-source-parsers/jsoncpp,

by entering the following command.

$ git clone https://github.com/open-source-parsers/jsoncpp.git


Thursday, January 30, 2020

Multithreading with wxWidgets

In this article, the use of multithreading with wxWidgets is discussed using C++ example programs. The following usage examples are discussed and detailed explanations for each of the step and function of using multhreading are presented.


A basic multithreading example, and the result of running the program is shown in the following link and the figure.

https://github.com/yan9a/cewx/blob/master/thread/thread1/thread1.cpp




Figure 1. thread1.cpp


Simple Multithreading Example

As a simple multithreading example, the program at the following link is discussed.

https://github.com/yan9a/cewx/blob/master/thread/th-simple/th-simple.cpp

Firstly, start, stop, pause, and resume buttons are added. Start button is used to create and start a new thread. Clicking the 'Stop' button looks for the last created thread and delete it. Pause button is used to pause the last started thread. Resume button is used to look for the last paused thread and run it.

Monday, October 22, 2018

Using MS SQL Server from C++ with wxWidgets



Using SQL Server with ODBC, C++, and wxWidgets

In this article, we will discuss about using MS SQL server with ODBC API from C++ program. [Eas18]. Thereafter, we will create a class module that connects to SQL server and use it with an example wxWidgets GUI application. For Unix and Linux machines, FreeTDS and ODBC need to be setup as discussed at the following link.

Using Microsoft SQL Server from Linux Machines with ODBC & FreeTDS
(http://coolemerald.blogspot.com/)


Thursday, October 4, 2018

MySQL Connector C++ 8.0 with wxWidgets

Let us discuss about using MySQL Connector C++ 8.0 with wxWidgets. Details about setting up and using wxWidgets, and MySQL server and connector can be found at the following links.

ceMySQL.h Cross-platform C++ programming with wxWidgets

Using MySQL Database with C++ on Various Platforms Including ARM Single Board Computers

For this example, by using MySQL Workbench, we will create a database called 'mytest' and a table called 'mytable' in the MySQL server that is to be connected and used.


Figure 1. Creating a database 'mytest' and a table 'mytable' using MySQL Workbench.


Tuesday, January 23, 2018

UDP/TCP Socket Programming with wxWidgets

  1. Introduction
  2. UDP
  3. TCP
  4. References

Introduction

In this article, UDP and TCP socket programming using wxWidgets is discussed. For that wxWidgets needs to be installed in your machine. Installing wxWidgets on Windows and Linux platforms can be seen at the following link.
Sockets are used to send and receive data on a network such as the Internet. Almost all modern operating systems support socket layer to transfer data using TCP or UDP. But programming sockets on different platforms usually involves platform specific tweaks. wxWidgets support socket classes which allow you to use sockets for transferring data without concerning about the platform. These classes can be used in various ways and some of them are discussed in the following sections.


Thursday, November 23, 2017

OpenCV with wxWidgets

  1. Introduction
  2. Linux
  3. Windows
  4. References

Introduction

In this article, using OpenCV with wxWidgets is discussed with examples. For that, OpenCV and wxWidgets need to be installed in your system. Installing and using them on Linux and Windows platforms can be found at the following links.

Linux

Building an application using OpenCV and wxWidgets in Linux terminal is simple. As an example, a simple program called wxcvsimple.cpp (online) is discussed below. At the start of the program, in OnInit() method of the Application,
wxInitAllImageHandlers();
is called. Then, wxStaticBitmap variables are declared in MyFrame class, a derived class of wxFrame, to display images. The following code can be used to initialize wxStaticBitmap in the constructor of MyFrame class.

Monday, October 30, 2017

Cross-platform C++ programming with wxWidgets

  1. Introduction
  2. Windows Setup
  3. Linux Setup
  4. Mac Setup
  5. References

Introduction

wxWidgets is a C++ library for creating cross-platform applications. It enables developers to create GUI code to compile and run on several computer platforms such as Windows, OS X, Linux and UNIX with minimal or no code changes.

wxWidgets is free and open source software which satisfies those who wish to produce for GPL and proprietary software without license costs [wxW98]. On the other hand, Qt is available for free under LGPLv3 license but has some limitations for commercial use unless you pay the license fee [Qt17].

wxWidgets uses Native platform , therefore GUI has more native look and feel [wxW12]. Qt extends the C++ language but wxWidgets does not extend the C++ language which is less surprising to developers expecting standard C++.

wxWidgets produces small and efficient binary applications. Therefore, it is suitable for embedded systems. In term of library size, Qt library is \(\approx 200\) MB where wxWidgets library is \(\approx 30\) MB.

wxWidgets not only works for C++, but also has bindings for python, perl, php, java, lua, lisp, erlang, eiffel, C# (.NET), BASIC, ruby and even javascript [wxW15a]. wxWidgets is one of the most complete and mature GUI toolkits. There are a lot of utility classes also.

wxWidgets is used by a huge range of organisations and individuals all over the world. Some of the better-known organisations who have used wxWidgets include NASA, AMD, Xerox, and Open Source Applications Foundation (OSAF). wxWidgets applications that you may be familiar with include AVG AntiVirus, Audacity, Filezilla, Code::Blocks, CodeLite.

Wednesday, May 31, 2017

Programming serial port in C++ for Windows, Mac and Linux

I have developed a class library 'ceSerial.h' to use serial port (com port) on Windows, Mac and Linux. This cross-platform 'ceSerial' class is written in C++ and we just need to include "ceSerial.h" in your source code in order to use it. A simple example for C++ console program using the class is demonstrated. The source code can be found at

https://github.com/yan9a/serial


Figure. A wxWidgets GUI application using 'Serial' class with Visual Studio 2017