OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Setting control properties

As you do when you get control properties, you set the value of a control property by 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::SetProp to set the properties of a control. SetProp is overloaded to allow you to set properties with either the index or name of the property. Each of these versions is further overloaded to allow you to set a number of different types of properties.

// set properties by index
bool SetProp(int propIndex, int value, int arrayIndex = -1);
bool SetProp(int propIndex, long value, int arrayIndex = -1);
bool SetProp(int propIndex, HPIC value, int arrayIndex = -1);
bool SetProp(int propIndex, float value, int arrayIndex = -1);
bool SetProp(int propIndex, const string& value, int arrayIndex = -1);
bool SetProp(int propIndex, const char far* value, int arrayIndex = -1);
// set properties by name
bool SetProp(const char far* name, int value, int arrayIndex = -1);
bool SetProp(const char far* name, long value, int arrayIndex = -1);
bool SetProp(const char far* name, HPIC value, int arrayIndex = -1);
bool SetProp(const char far* name, float value, int arrayIndex = -1);
bool SetProp(const char far* name, const string& value, int arrayIndex = -1);
bool SetProp(const char far* name, const char far* value, int arrayIndex = -1);
ParameterExplanation
first parameterIn the versions where the first parameter is an int, you specify the property by passing the property index. In the versions where the first parameter is a char *, you specify the property by passing the property name.
second parameterThe second parameter is the value the property should be set to.
third parameterThe third parameter is 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.

Although there are five different data types you can pass to TVbxControl::GetProp, SetProp provides for six different data types. The last two versions of each type of call use a char * and the ANSI string class to represent a string. These versions allow flexibility when passing a character string into a control.

GetProp uses casting to allow a char * to function effectively as a string object.

See Also