CapitolSoft Banner
Features
Tutorials
F.A.Q.s
Downloads
Articles
Open Architecture
Control Development Kit
RAD Foundation Class
Enhanced IntelliSense
Samples
Migration Center
Links

Testing the Modified Control

Since we last tested (Part 2: Testing the New Control) our "Circle" control, we have added quite a few attributes to the control. Our control now have a property called "CircleShape", an event called "ClickIn" and a method called "AboutBox". We will now test the control again to see if these attributes really work.

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).

CppCtrl_Prop1.jpg (18868 bytes)

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".

CppCtrl_CodeBar.jpg (20675 bytes)

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..

CppCtrl_testMethod.jpg (42861 bytes)

 

void CForm1::Button1_Click()
{
    m_Circle1.AboutBox();
}

CppCtrl_MethodTest.jpg (27555 bytes)

 

Next >> Part 10: Creating ActiveX Control from C++ Control

Related Links:

Control Development Kit (CDK) Home

 

 

Microsoft Visual C++, Microsoft Visual Basic and Microsoft Visual Studio are registered trademarks of Microsoft Corporation.
Copyright © 1998-2000 Capitolsoft Corporation. All rights reserved.
Disclaimer: Capitolsoft Corporation is an independent business organization incorporated with the State Commission of Virginia and hence has no connection with U.S. Capitol or any other federal agency of U.S. government. Opinions expressed by the individuals in this site are of their own alone and hence do not necessarily reflect the views of Capitolsoft Corporation.

 

This page was last updated on November 21, 2005
Hit Counter