Gadgets > Creating GUI Applications with Rogue Wave Views Studio > Using the Generated Code > Extending the Generated Code > Using the Derived Class
 
Using the Derived Class
To use MyFirstPanelClass instead of FirstPanelClass, which is needed to create FirstPanel:
*Set the User Class field in the Panel Instance inspector.
*Insert a #include statement in the generated application header file.
Setting Up the User Class
To set up the user class:
1. In the Application buffer window, double-click the first instance of FirstPanelClass.
2. In the Panel Instance inspector, type MyFirstPanelClass in the User Class field:
3. Click Apply, then Close.
Note: Steps 2 and 3 can be repeated for SecondPanel.
Instead of generating the following code in the makePanels function:
cont = new FirstPanelClass(display,
“FirstPanel”,
“First Panel”,
&bbox,
IlFalse,
IlFalse, 0, 0);
);
Rogue Wave Views Studio generates the code below in the application source file myappli.cc:
cont = new MyFirstPanelClass(display,
“FirstPanel”,
“First Panel”,
&bbox,
IlFalse,
IlFalse, 0, 0);
);
Since MyFirstPanelClass is declared in myclass1.h, you need to include this file in myappli.h.
Inserting Code in the Generated Application Header File
1. Choose Application Inspector from the Code menu. The Application inspector is displayed.
2. In the Application inspector, open the Header notebook page.
3. In the Header notebook page, type #include <myclass1.h>:
4. Click Apply, then Close.
When generating the application source file again, Rogue Wave Views Studio inserts the following expression in the application header file:
// -----------------------------------------------------------------
// --- Inserted code
 
#include <myclass1.h>
 
// --- End of Inserted code
Linking Additional Object Files
The make file generated by Rogue Wave Views Studio takes care of compiling the generated files and linking the application. In addition, it can link your own object files to the application through the make USEROBJS variable. You are responsible for your own object files. However, you can write your own make file to maintain the additional object files by copying the make options generated by Rogue Wave Views Studio.
For example, if the definition of the MyFirstPanelClass::SliderCB is in your object file myclass1.o, you can use the generated make file myappli.mak like this:
make -f myappli.mak USEROBJS=myclass1.o

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