OWLNext 7.0
Borland's Object Windows Library for the modern age
|
You can get the value of a control property using either its name or its index number.
Although using the index is more efficient (because there is no string lookup), using the property name is usually more intuitive. You can use either method, depending on your preference.
TVbxControl provides the function TVbxControl::GetProp" to get the properties of a control. GetProp is overloaded to allow use of either the index or the name of the property. Each of these versions is further overloaded to allow you to obtain different types of properties: @code // get properties by index bool GetProp(int propIndex, int& value, int arrayIndex = -1); bool GetProp(int propIndex, long& value, int arrayIndex = -1); bool GetProp(int propIndex, HPIC& value, int arrayIndex = -1); bool GetProp(int propIndex, float& value, int arrayIndex = -1); bool GetProp(int propIndex, string& value, int arrayIndex = -1); // get properties by name bool GetProp(const char far* name, int& value, int arrayIndex = -1); bool GetProp(const char far* name, long& value, int arrayIndex = -1); bool GetProp(const char far* name, HPIC& value, int arrayIndex = -1); bool GetProp(const char far* name, float& value, int arrayIndex = -1); bool GetProp(const char far* name, string& value, int arrayIndex = -1); \endcode <TABLE BORDER="0" CELLSPACING="0" class="owltable"> <TR class="owltable"><TD class="owltableheader">Parameter</TD><TD class="owltableheader">Explanation</TD></TR> <TR class="owltable"><TD class="owltable">first parameter</TD><TD class="owltable">In versions where the first parameter is an int, specify the property by passing in the property index. In versions where the first parameter is a char *, specify the property by passing in the property name.</TD></TR> <TR class="owltable"><TD class="owltable">second parameter</TD><TD class="owltable">A reference to an object with the same data type as the property. It is used by GetProp to return the property value. Create an object of the same type as the property and pass a reference to the object in value. When GetProp returns, the object contains the current value of the property.</TD></TR> <TR class="owltable"><TD class="owltable">third parameter</TD><TD class="owltable">The index of an array property that you supply if the control requires it. Consult the documentation for your VBX control to discover if you need to supply this parameter and, if so, what the required values are. The function ignores this parameter if it is -1.</TD></TR> </TABLE> @section seealso See Also - \ref findingpropertyinformation "Finding property information" - \ref settingcontrolproperties "Setting control properties"