[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

Developing Photon Applications

You can select a topic from this diagram:

Utilities Used by the IDE Getting System Information Using Code Coverage Common Wizards Reference Preparing Your Target Developing Photon Applications Developing C/C++ Programs Where Files Are Stored Building OS and Flash Images Migrating to the 6.3 Release Tutorials IDE Concepts About This Guide Analyzing Your System With Kernel Tracing Profiling an Application Finding Memory Errors Debugging Programs Managing Source Code Launch Configurations Reference

Workflow with PhAB chapter highlighted

Use the PhAB visual design tool to develop Photon apps.

In this chapter...

What is PhAB?

The Photon microGUI includes a powerful development tool called PhAB (Photon Application Builder), a visual design tool that generates the underlying C/C++ code to implement your program's UI.

With PhAB, you can dramatically reduce the amount of programming required to build a Photon application. You can save time not only in writing the UI portion of your code, but also in debugging and testing. PhAB helps you get your applications to market sooner and with more professional results.

PhAB lets you rapidly prototype your applications. You simply select widgets, arrange them as you like, specify their behavior, and interact with them as you design your interface.

PhAB's opening screen looks like this:

PhAB screen shot

PhAB and the IDE

The IDE frequently runs command-line tools such as gdb and mkefs "behind the scenes," but PhAB and the IDE are separate applications; each runs in its own window. You can create files, generate code snippets, edit callbacks, test your UI components, etc. in PhAB, while you continue to use the IDE to manage your project as well as debug your code, run diagnostics, etc.

PhAB was originally designed to run under the Photon microGUI on a QNX Neutrino host, but the phindows ("Photon in Windows") utility lets you run PhAB on a Windows host as well. The IDE lets you see, debug, and interact with your target Photon application right from your host machine as if you were sitting in front of your target machine.

Using PhAB

In most respects, using PhAB inside the IDE is the same as running PhAB as a standalone application.

Note: For a full description of PhAB's functionality, see the Photon Programmer's Guide.

Creating a QNX Photon Appbuilder project

In order to use PhAB with the IDE, you must create a QNX Photon Appbuilder project to contain your code. This type of project contains tags and other information that let you run PhAB from within the IDE.

To create a PhAB Project:

  1. From the workbench menu, select File-->New-->Project....
  2. In the list, select QNX.
  3. Select Photon Appbuilder Project.

    Creating a new PhAB project

  4. Click Next.
  5. Name your project.

    Creating a new PhAB project

  6. Ensure that Use Default Location is checked. Don't use a different location.
  7. Click Next.
  8. Select your target architecture. Be sure to set one of your variants as the default variant (select the variant, then click the Default button).

    Creating a new PhAB project

    Note: If you wish to set any other options for this project, click the remaining tabs and fill in the fields. For details on the tabs in this wizard, see "New C/C++ Project wizard tabs" in the Common Wizards Reference chapter.

  9. Click Finish.

    The IDE creates your project, then launches PhAB. (In Windows, the IDE also creates a Console for PhAB window.)

Closing PhAB

To end a PhAB session:

=>> From PhAB's main menu, select File-->Exit.

Note: In Windows, don't end a PhAB session by clicking the Close button in the top-right corner of the PhAB window; clicking this button closes the phindows utility session without letting PhAB itself shut down properly. Subsequent attempts to restart PhAB may fail.

To recover from improperly closing PhAB:

  1. Close the Console for PhAB window.
  2. Reopen your QNX Photon Appbuilder project.

Reopening PhAB

=>> To reopen your QNX Photon Appbuilder project open the Project menu and click Open Appbuilder.

Editing code

You can edit the code in your QNX Photon Appbuilder project using both PhAB and the IDE. Using PhAB, you can control the widgets and the overall layout of your program; using either PhAB or the IDE, you can edit the code that PhAB generates and specify the behavior of your callbacks.

To use PhAB to edit the code in a QNX Photon Appbuilder project:

  1. In the C/C++ Projects view, select a QNX Photon Appbuilder project.
  2. Click the Open Appbuilder button in the toolbar (Icon: PhAB). PhAB starts, then opens your project.

Note: If for some reason the Open Appbuilder button isn't in the C/C++ perspective's toolbar:
  1. From the main menu, select Window-->Customize Perspective.
  2. In the left pane, select Other-->Photon Appbuilder Actions.
  3. Check Photon Appbuilder Actions.
  4. Click OK. The Open Appbuilder button (Icon: PhAB) appears in the toolbar.

To use the IDE to edit the code in a QNX Photon Appbuilder project:

=>> In the C/C++ Projects view, double-click the file you want to edit. The file opens in an editor.

If a file that you created with PhAB doesn't appear in the C/C++ Projects view, right-click your project and select Refresh.

Note: Editing files using two applications can increase the risk of accidentally overwriting your changes. To minimize this risk, close the file in one application before editing the file in the other.

Building a QNX Photon Appbuilder project

You build a QNX Photon Appbuilder project in exactly the same way as other projects. (For information on building projects, see the "Building projects" section in the Developing Programs chapter.)

To build a QNX Photon Appbuilder project:

=>> In the C/C++ Projects view, right-click your QNX Photon Appbuilder project and select Build. The IDE builds your project.

Starting Photon applications

You can connect to a Photon session from a Windows or QNX Neutrino host machine and run your Photon program as if you were sitting in front of the target machine. Photon appears in a phindows window on your Windows host or in a phditto window on your QNX Neutrino host.

The remote Photon session runs independently of your host. For example, the clipboards don't interact, and you can't drag and drop files between the two machines. The phindows and phditto utilities transmit your mouse and keyboard input to Photon and display the resulting state of your Photon session as a bitmap on your host machine.

Before you run a remote Photon session on a Windows host, you must first prepare your target machine. (For details, see the "Connecting with Phindows" section in the Preparing Your Target chapter.)

To start a remote Photon session:

=>> In the Target Navigator view, right-click a target and select Launch Remote Photon.

Photon appears in a Phindows window.

You can start a Photon application you created in PhAB in exactly the same way that you launch any other program in the IDE. By default, the program opens in the target machine's main Photon session. (For more on launching, see the Launch Configurations Reference chapter in this guide.)

To run your Photon program in a remote Photon session window:

  1. In the remote Photon session, open a command window (e.g. a terminal from the shelf).
  2. In the command window, enter:
    echo $PHOTON

    The target returns the session, such as /dev/ph1470499. The number after ph is the process ID (PID).

  3. In the IDE, edit the launch configuration for your QNX Photon Appbuilder project.
  4. Select the Arguments tab.
  5. In the C/C++ Program Arguments field, enter -s followed by the value of $PHOTON. For example, enter -s /dev/ph1470499.
  6. Click Apply, then Run or Debug. Your remote Photon program opens in the phindows or phditto window on your host machine.
    Note: If you close and reopen a remote Photon session, you must update your launch configuration to reflect the new PID of the new session.

[Previous] [Contents] [Index] [Next]