To do this, let us
first open the project we used to perform the earlier test and then open the form
containing our "Circle" control in it. (a) Testing a Property: To test the newly added property "CircleShape", let us first select
the Circle control on the form. Now we should the new property in the property listbox
(figure below).
Now change the "CircleShape" property value
from "FALSE" to "TRUE". This will add the following code in the form's
"SetProperties()" function:
m_Circle1.CircleShape = TRUE;
Note the VB-like coding syntax in the above property
statement. Also note that the properties of RAD C++ controls are set through "3-way
RAD" technology.
Now recompile the project and run the test application.
Our control will now show as a perfectly round circle (figure below).
(b) Testing an Event: To
test a RAD C++ event, double-click on the Circle control to display "RadVC
CodeBar". From the "Proc" combobox, select the event "ClickIn".
This will add the following
code in the form's constructor.
AddHandler(m_Circle1,
ClickIn, CForm1, Circle1_ClickIn)
..and the following
code in the form's class declaration..
long
Circle1_ClickIn(..);
A corresponding
event handler will be introduced in the form's implementation file
- long
CForm1::Circle1_ClickIn(..)
- {
- ....
- }
(c) Testing a Method: To
test our 'Circle' control's "AboutBox" method, We will
create a command button on the form and override the button's
'Click' event. Now simply call the control's method from inside
the 'Click' event handler..
void CForm1::Button1_Click()
{
m_Circle1.AboutBox();
}
Next >> Part
10: Creating ActiveX Control from C++ Control
Related Links: |