Andrew Moa Blog Site

Handling Event Callback Functions with Lambda Expressions

C++11 began supporting lambda expressions. Besides being used as anonymous functions, lambda expressions can also access variables in the surrounding environment through a capture list. In UI programming, using lambda expressions instead of traditional function pointers for handling callback functions can not only simplify the code and improve readability but also reduce parameter passing and increase flexibility. Below, we attempt to implement related operations for commonly used C++ UI libraries.
19 minutes to read
Andrew Moa

Exploring implementation methods for separating interface and methods

Separating the program’s UI from the implementation code of its methods is very helpful for improving development efficiency and code readability. Mainstream UI libraries such as Qt, wxWidgets, and GTK each have their own implementation approaches, which will be demonstrated below.

1. wxWidgets project based on XRC

1.1 Write XRC file

wxWidgets supports defining the UI through XML format and saving it as an XRC file. Using XRC files allows for separating the interface from the code, but the downside is that the released program will be slightly larger compared to the non-XRC version.

14 minutes to read
Andrew Moa

Managing C++ project dependencies using Conda

When I previously tried xrepo, I learned that conda can also manage C++ projects1. Now, I will verify this with some commonly used libraries. The conda installation process will not be detailed here; it is recommended to refer to the official documentation2. Since the libraries provided by conda are often released in dynamically linked form, in order to ensure that the packaged output of the program can run properly, I will attempt to use CMake to automatically package the dependent library files.
12 minutes to read
Andrew Moa