Most of the time when i create a new project and generate a code for the same,PhAB generates C code(abmain.c). Not able to find a way to generate abmain.cc.
you hav to define a callback function located in a C++ file (e.g. setup@setup.cc) before you build the user interface the first time. If you do this, PhAB creates *.cc files instead of *.c files.
-Peter
Thanks Peter!
i could not understand giving the callback function in a c++ file.
Normally while creating a new project i choose a plain window to start with and then i put some controls(buttons etc.) on that window and then i add “activate”(on button click) function. Then i generate code and modifies the C-file generated by PhAB for that button click function.
Exactly where and how i can implement your suggestion in the above mentioned steps or am i missing some step.Please elaborate on that.
cyvinay4,
there are different places where you can define callback functions in PhAB. One is your example of a button activat callback - an other is my example of the setup callback function (Project->Properies->Setup Function)
In the text field you have to write the name of the callback function you want to be generated by PhAB. Now you have the possibility to specifiy the name of the file in which the callback function will be located: you simply add a ‘@’ and the filename to the callback function name. My example above will generate the setup callback function in a file named ‘setup.cc’.
And this is the trick: if PhAB detects a filename ending ‘.cc’ it assumes the project is C++.
BUT: there are a lot of other things you have to know until you will succeed with PhAB and C++ (e.g. you need to add the C++ nature to your Photon project in Momentics). It’s a job for an experienced programmer willing to understand the architecture of Photon (and PhAB).
Pointers:
- search for “PhAB C++” in this forum
- have a look at phontonmm.sourceforge.net/index.html
I would consider the following for an application architecture:
- strong separation of GUI and application logic (library, resource manager, …)
- Use PhAB and plain C for the GUI
- or use C++ and Photon without PhAB for the GUI
-Peter