Graphical user interface programming for QNX
QNX comes with a graphical user interface system called Photon. It's an event-driven C-based system, generally similar to those on most other platforms.
Using the Photon Application Builder (PhAB)
Photon applications are built using the Photon Application Builder, which does layout, generates code, and in a limited way, manages the project. There are five tutorials on the Photon Application Builder available in the QNX help system. Working through them takes about a day, and is reasonably worthwhile. Tutorials 1-4 are good. Tutorial 5 is poorly designed and has some bad coding practices, but is worth doing as a bad example.
The generated code consists of big files containing GUI data, and tiny stub files for any "callbacks" the programmer asks PhAB to generate. The stub source files generated by PhAB contain no data that PhAB needs to change. Once created, PhAB will not overwrite them. You can safely go back and change your graphical elements, then "regenerate" in PhAB.So editing a stub file doesn't commit you to layout decisions made via PhAB.
Photon is a C GUI, but it is possible to use it with C++. All the C code it generates appears to compile and run with C++.
To work in C++, use the Application->Build+Run menu and click on Advanced Options..., which brings up the Build Preferences dialog. By default, this just says "make". Change it to "make -e CC=QCC LD=QCC", which will cause PhAB to generate makefiles which call the QCC compiler (for C++) for compiling and linking.
After doing this, C++ code in Photon-generated stubs will work
Adding your own files to a PhAB project
PhAB generates three files which tell PhAB's makefiles what files belong to the project: These just set variables for the makefiles. Here's an example of adding a C++ source file to the project.
"cameraread" has now been added to the project, and will be compiled
Photon and CVS
(from the Photon manual)
Here are the files you need to save if you're using version-control software (PhAB can generate some of them, but it's a good idea to save them all):
The files listed as "OK to edit" are created initially by PhAB, but can then be manually edited. PhAB. PhAB creates them if they do not exist, but does not change their contents if they do exist.
There's one known exception to this. If you change the type of a widget, source files may be regenerated.
The generated makefiles can be edited if absolutely necessary, but it's better to change "Command to make application" and the "ind*" files to modify the build process.
Overall, PhAB is easier to use than the corresponding tools for Windows and Macintosh platforms. The widgets aren't as pretty, but they work. PhAB is an object-oriented system written in C, which is always a bit painful, but it's not overdone and works reasonably.
More to come.
To be addressed: