The Burger Order Dialog Box Use Case |
| Use Case |
AbstractThis article discusses the CAAIDDBurger.m module of the CAACodeGenTools.edu framework. It shows how to design and manipulate a dialog box using the Rich Application Presentation Designer - IDD, and how to build the interactive application needed to display and run it. |
This integration example is intended to cover the tasks needed in order to design a basic calculator dialog box with the designer. These tasks are:
CAAIDDBurger is a use case of the CAACodeGenTools.edu framework that illustrates Rich Application Presentation Designer's capabilities.
This example shows how to manipulate some widgets of the Dialog framework in a dialog box, editing their properties, simulating their behavior using the Rich Application Presentation Designer. The Burger Order Dialog Box is a fast-food order dialog box. It allows you to select what you wish to eat and drink.
Below is the how the dialog box looks like:

The Dialog framework objects that you can use for selecting a value or an attribute and that react to your selection are controls like radio buttons, combos or spinners. The different controls are gathered in frames. For example, the Hamburger frame includes a slider to select the number of hamburgers you want, radio buttons to choose the cooking, and click buttons to add condiments. Separators help to distinguish the three frames, and above, labels help to understand what their contents refer to. Labels can also be used for other Dialog framework objects such as the combo to choose the fries size, or the editor to choose the fries quantity. A selector list with a scrollbar allows you to select a drink within the list and a spinner lets you order the number of drinks you want. These objects are shown below:

To launch CAAIDDBurger, you will need to set up the build time environment, then compile CAAIDDBurger along with its prerequisites, set up the run time environment, and then execute the use case [1] and [2].
The CAAIDDBurger use case is made of a several classes located in the CAAIDDBurger.m module of the CAACodeGenTools.edu framework:
InstallRootFolder\CAADoc\CAACodeGenTools.edu\CAAIDDBurger.m\
where InstallRootFolder [1] is the folder where the API CD-ROM is installed.
The CAAIDDBurger.m module includes four files:
| CAABurgerApplication.cpp | The interactive application (the one that launches the dialog) source file |
| CAAIDDBurgerDialog.DSGen | The Dassault Systemes code generation file (design file) |
The designer will automatically generate the C++ files (header and implementation) associated to a designed dialog box which are:
| CAAIDDBurgerDialog.h | The dialog box header file |
| CAAIDDBurgerDialog.cpp | The dialog box source file |
If you open CAAIDDBurger use case with Microsoft Visual Studio as shown in [1] and [2], you will find the CAAIDDBurger.m module that includes CAAIDDBurguerDialog.DSGen, double click on it for displaying the burger dialog box in design view. To design it you select your desired widget, drag and drop it inside dialog box, then choose properties in the context menu to edit selected widget characteristics. For more details see [3]
The designer creates a source and header files that are generated from the designer file (.DSGen). Each file is accessible from context menu on the design surface :

Designing choices are translated in generated files; Furthermore design and code are permanently synchronized. Let's have a look at the beginning of CAAIDDBurgerDialog.h:
// BEGIN OF HEADER CODE
// ----------------------------------------
#ifndef CAAIDDBurgerDialog_h
#define CAAIDDBurgerDialog_h
#include "CATDlgDialog.h"
class CATDlgFrame;
// Begin of User Code
// End of User Code
class CAAIDDBurgerDialog : public CATDlgDialog {
public:
CAAIDDBurgerDialog(CATDialog * iParent, const CATString& iDialogName);
virtual ~CAAIDDBurgerDialog();
void Build();
.....
private:
CATDlgFrame* _Frame3;
CATDlgSelectorList* _SelectorList1;
CATDlgLabel* _Label6;
CATDlgSpinner* _Spinner1;
CATDlgFrame* _Frame2;
....
};
#endif
Chosen widgets included in dialog box are declared as members in the header file and instanciated in the source file.
The designer is able to show the burger dialog box's behavior when it is resized; to test the burger application quickly and accurately, use simulate context menu on design view.


Thanks to the interactive application CAAIDDBurgerApplication the Burger dialog box can be displayed and run as a standalone application. The dialog box is created in the BeginApplication method, it is first instantiated, then initialized using its Build method, and set as visible. Finally, when you build the application as shown in [1], you get the application compiled with its behavior.
void CAAIDDBurgerApplication::BeginApplication()
{
....
// Creation of designed child dialog box
CAAIDDBurgerDialog * pMainWindow ;
pMainWindow = new CAAIDDBurgerDialog(pDocument, "BurgerId");
....
// Constructs all Dialog'objects of the window
pMainWindow->Build();
// Make dialog visible
pMainWindow->SetVisibility(CATDlgShow);
}
| [1] | Building and Launching a Use Case |
| [2] | Starting Rich Application Presentation Designer |
| [3] | Interaction Techniques |
| Version: 1 [May 2010] | Document created by am2 |