Gadgets > Creating GUI Applications with Rogue Wave Views Studio > Using the Generated Code > Generating the C++ Code > MyApplication Source File
 
MyApplication Source File
Class Header File
The application source file always includes the generated application class header file:
#include <myappli.h>
makePanels Function Definition
The generated makePanels member function looks like this:
void
MyApplication::makePanels()
{
// --- parameters ---
IlvDisplay* display = getDisplay();
IlvRect bbox;
IlvContainer* cont;
// --- FirstPanel ---
bbox.moveResize(200, 200, 500, 500);
cont = new FirstPanelClass(display,
“FirstPanel”,
“First Panel”,
&bbox,
IlFalse,
IlFalse, 0, 0);
addPanel(cont);
cont->show();
// --- SecondPanel ---
bbox.moveResize(200, 300, 500, 500);
cont = new FirstPanelClass(display,
“SecondPanel”,
“Second Panel”,
&bbox
IlFalse,
IlFalse, 0, 0);
addPanel(cont);
cont->show();
// --- Result ---
bbox.moveResize(200, 400, 500, 500);
cont = new SecondPanelClass(display,
“Result”,
“Result Panel”,
&bbox
IlFalse,
IlFalse, 0, 0);
addPanel(cont);
cont->setDestroyCallback(IlvAppExit, this);
cont->show();
// --- The Exit panel is not wanted ---
setUsingExitPanel(IlFalse);
}
This application contains three panels: FirstPanel and SecondPanel are part of the class FirstPanelClass. The following points should be noted:
*Each panel is created at the position specified in the x and y fields of the Panel Instance inspector (Sizes notebook page).
*The size of the rectangle passed to the panel constructor does not really affect the panel sizes, since they are resized when their data is loaded. If the Generate Size toggle button of the Panel Instance inspector (Sizes notebook page) is turned on, the Bounding Box Width and Height values specified in the Panel Instance inspector are used to resize the panel after it is created.
*Each panel is added to the application after being created:
addPanel(cont);
*If the Visible toggle button in the Panel Instance inspector (General notebook page) is turned on, that panel is shown by the show() member function:
cont->show();
*The following code is generated because the destroy callback of the Result panel is set to Exit in the Panel Instance inspector (General notebook page):
cont->setDestroyCallback(IlvAppExit, this);
*Since the Exit panel is not wanted, the following code is generated:
setUsingExitPanel(IlFalse);
main Function
Because the main() toggle button is checked in the Options notebook page of the Application Inspector, the main function is generated in the application source file:
main(int argc, char* argv[])
{
// IlvSetCurrentCharSet(<YourCharSet>);
IlvSetLanguage();
MyApplication* appli = new MyApplication(“myappli”, 0, argc,
argv);
if (!appli->getDisplay())
return -1;
appli->run();
return 0;
}
This function creates an application of class MyApplication. Before running the application, the function checks whether the created application succeeded in creating a display.
If you do not want the main function to be generated, turn off the main() toggle button.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.