FOX GUI Toolkit


The FOX GUI Toolkit is worth a look when you need a powerful and free C++ GUI Toolkit.


FOX was written by a programmer who had been struggling with visualization of fluid dynamics using Motif... not fun, apparently. So the FOX toolkit was born. It originally stood for “Free Objects for X” but has since become multi-platform.

The toolkit is available from ““. The main page presents a changelog which is focused on practical matters rather than distracting eye candy. However, the “projects” link has screenshots of commercial and free projects using FOX. Take time to follow the documentation link. FOX incorporates the most interesting ideas of modern GUIs and these are clearly explained there.

I tried FOX on Linux, FreeBSD, and Windows-any. It works the same everywhere. For Win32 it statically links “com32ctl.lib”. I didn’t see any DLLs so I expect deployment of mundane applications to be simple.


FOX has the Observer design pattern built-in. This is not stated in the documentation, it is just my observation. It does this with message-maps and datatargets which enable any number of widgets to watch a data variable. When the variable changes, all widgets change automatically. This was very useful for an Emulator I wrote where “temperature” could be varied by the serial port, a textfield, a slider, and a dial-spinner thingy that FOX includes. Note that the behaviour appears tightly coupled but the code is not so the temperature widget group can be reused for some other purpose in the same application or even a different one. Observing a data variable only requires a reference to a datatarget instance in each widget constructor. Widgets such as buttons which generate events require a handler method declared in the message map. Implementation is easy after you have figured out a demo program.

The FOX “tests/” folder contains a variety of interesting demos to showoff the available widgets. The demos are impressive but the compact, efficient code may be hard to read. After reformatting with Emacs, I wrote a useful C++ app by refactoring snippets of code from the datatarget demo.

FOX code is very dense relative to Java. The aforementioned Observer pattern in Java requires the methods of several classes per data item. FOX does it all in the widget constructor. FOX includes assigned defaults in the constructor so it only needs one where Java needs a bunch. Fortunately, the Fox defaults are good enough for mundane apps.

It is interesting to compare the signal-slot mechanism of QT to the message-map/datatarget of Fox. Both strive to overcome the static nature of C++ which compares unfavourably to Objective-C in this context. QT is effective but creates another file for every C++ file you write containing “connects”. This is the meta-object-compiler. Fox is equally effective and lighter since it does not use an extra pre-processor.

What .. no GUI designer

I tried a QT tutorial. The GUI designer works nicely but is rather boring since it is basically filling out a form .. like doing income tax. On the other hand, the startup cost for FOX is higher because you need to understand the layout managers. But it gets easier with practice. Perhaps easier than filling out forms. I think the default behaviours for grid layouts is better in FOX than Java. A grid layout in FOX is called a matrix. Widgets placed in a FOX matrix do not automatically expand to fill a box as do buttons in an ugly Java grid layout.


Makefiles are provided in FOX for Visual, Borland, and others. I used openwatcom since it is a former commercial compiler now freely available. But you can always create a Visual C++ project if you prefer.


FOX directly supports object programming without Frameworks, wizards, or resource files to obfuscate or complicate understanding. It has a rich set of widgets, and features I have not investigated, such as bindings for OpenGL and other programming languages.

I am interested mainly in control programs for hardware plus emulators for software test jigs. Others may find it suitable for a different class of applications.

Finally, this is not intended a put-down of QT which offers much with a clean design. I find it similiar to using Java.

Personal Tools