Adding ActiveX Controls as Graphic Objects into an Rogue Wave Views Application > Presentation of the Rogue Wave Views Application of this Example > Step 5: Getting the Value of the Property of a Control
 
Step 5: Getting the Value of the Property of a Control
This step shows how to get the value of a property of the control. The code is based on the property Day of the Calendar control. You will have to modify the name of the property and its type if you choose another property and/or another control.
We will just modify slightly the code of step3 so that the GetTypeAccelerator also displays the value of the property Day when the control type is Calendar.
To do this, we replace the line:
IlvCOut << "The type is: " << userType << ".\n";
by the first line below:
IlvCOut << "The type is: " << userType;
// Code added for step 5.
if (!wcscmp(userType, L"Calendar")) {
IlvValue value("Day");
IlInt day = adapt->queryValue(value);
IlvCOut << ", the day is: " << day;
}
IlvCOut << ".\n";
After having checked that the type of the control is effectively Calendar, an IlvValue object whose name is the name of the property (Day in this case) is instantiated. Then the value of this property is obtained by calling queryValue on the IlvGraphicCOMAdapter object (as for any value object in Rogue Wave Views). Then the value is displayed with IlvCOut.
You see that it is very easy to access a property and to get its value. To modify its value would also be simple. For example, to set the Day property to 5, you would write:
IlvValue value("Day", 5);
adapt->changeValue(value);
See the reference pages of IlvValue and IlvGraphic for more details.

Version 5.5.1
Copyright © 2012, Rogue Wave Software, Inc. All Rights Reserved.