Gadgets > Creating GUI Applications with Rogue Wave Views Studio > Using the Generated Code > Extending the Generated Code > Defining a Derived Class
 
Defining a Derived Class
In the file myclass1.h, you will declare MyFirstPanelClass like this:
#include <class1.h>
 
class MyFirstPanelClass
: public FirstPanelClass {
public:
MyFirstPanelClass(IlvDisplay* display,
const char* name,
const char* title,
IlvRect* size = 0,
IlBoolean useAccelerators = IlFalse,
IlBoolean visible = IlFalse,
IlvUInt properties = 0,
IlvSystemView transientFor = 0):
FirstPanelClass(display,
name,
title,
size,
useAccelerators,
visible)
{}
virtual void SliderCB(IlvGraphic*);
IlvInt getValue() const { return getTextField()->getIntValue(); }
};
Base Class
MyFirstPanelClass is derived from FirstPanelClass.
Constructor
You only need to define one constructor. This constructor builds the panel as a main window and calls its base class constructor.
Callback Method
The SliderCB virtual member function is redefined in the derived class to display the slider value in the text field. Here is a possible definition of such a function:
void
MyFirstPanelClass::SliderCB(IlvGraphic*)
{
getTextField()->setValue(getSlider()->getValue(), IlTrue);
}
getValue Member Function
To get the value displayed by the panel, you must define this inline member function:
IlvInt getValue() const { return getTextField()->getIntValue(); }

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.