GLG Toolkit, C / C++ API Library  Version 4.6
Object Configuration

This group contains methods that may be used to edit and configure objects in the drawing at run time. More...

Detailed Description

This group contains methods that may be used to edit and configure objects in the drawing at run time.

Functions

GlgBoolean ConstrainObject (GlgObjectC &to_attribute)
 Constrains an attribute or a point of an object to an attribute or a point of another object. More...
 
void ReleaseObject (void)
 Releases an object that was suspended for editing. More...
 
void SuspendObject (void)
 Suspends a drawn object for editing. More...
 
GlgBoolean UnconstrainObject (void)
 Unconstrains an attribute or point object stored in this object. More...
 

Function Documentation

◆ ConstrainObject()

GlgBoolean ConstrainObject ( GlgObjectC to_attribute)

Constrains an attribute or a point of an object to an attribute or a point of another object.

This is a wrapper for GlgConstrainObject.

This method constrains attribute or point object stored in this object. To obtain the object ID of the attribute or point object to be constrained, the GetResourceObject method must be used with a default resource name rather than a user-defined resource name as the last part of resource path. For example, "object1/FillColor" must be used to get the object ID of the FillColor attribute of my_object, and not "my_object/my_color".

For objects that have a fixed number of control points (Arc, Text, etc.), use the default attribute name ("PointN") to access an object's Nth control point. For objects with a variable number of points (e.g. polygons), use the GetElement or Iterate method to get its points and use them as the from_attribute.

Parameters
to_attributeThe attribute or the point to constrain to. This object may be queried by using either the default or a user-defined resource name.
Returns
Success or failure status.

The method constrains the attribute or the point stored in this object to the attribute or the point specified by to_attribute. If two attributes are constrained, changing the value of either attribute changes the values of both. For more information about constraining, see the Constraints section in the Structure of a GLG Drawing chapter of the GLG User's Guide and Builder Reference Manual.

If the object whose attribute is being constrained has already been drawn, an error message will be generated. You should either constrain object attributes before drawing the object or use the SuspendObject and ReleaseObject methods to temporarily suspend a drawn object for editing.

You cannot constrain any objects beside attribute objects (a control point is an attribute object as well). The objects being constrained must be of the same data subtype. That is, you cannot constrain a color attribute object (G type) to the line width attribute object (D type) because they have different data types.

If any of the conditions above are not satisfied, the method fails and returns False. If constraining is successful, the method returns True.

Note that constraining an attribute object causes all the attributes of the attribute object to be identical to the attributes of the object to which it is constrained, including its name, transformation and value. If a transformation is added to an attribute object, it is automatically added to all the attribute objects that are constrained to this attribute object in order to maintain the constraints.

Similarly, if the object name is changed, it is automatically changed for all the objects that are constrained to the object. These changes are permanent and remain in effect even after the constraints are removed.

◆ ReleaseObject()

void ReleaseObject ( void  )

Releases an object that was suspended for editing.

This is a wrapper for GlgReleaseObject.

This method releases a previously suspended object and is intended to be used only in conjunction with the SuspendObject method.

◆ SuspendObject()

void SuspendObject ( void  )

Suspends a drawn object for editing.

This is a wrapper for GlgSuspendObject.

Some operations, such as attaching a transformation to an object, constraining an object's attribute and some others, may be carried out only before the object has been drawn. If the object has been drawn and you still need to perform these operations, the SuspendObject method must be used to suspend the object for editing. If SuspendObject is not used, any attempt to perform these modifications will fail, producing an error message.

SuspendObject may be called only for the graphical objects, such as a viewport, group, polygon, or others.

The ReleaseObject method must be called after the editing operations have been completed. If an object is suspended, it is not allowed to call Update until the object has been released.

◆ UnconstrainObject()

GlgBoolean UnconstrainObject ( void  )

Unconstrains an attribute or point object stored in this object.

This is a wrapper for GlgUnconstrainObject.

Returns
Success or failure status.

This method removes any constraints applied to an attribute object. Any changes made to the object while it was constrained to another object are permanent and will be in effect even after the constraints are removed. The removal of the constraints only means that changes to this object are no longer copied to the other objects to which it was once constrained.

If any of the objects which are using this attribute object (or any objects with attributes constrained to it) have already been drawn, an error message will be generated. You should either unconstrain object attributes before drawing the object or use the SuspendObject and ReleaseObject methods to temporarily suspend a drawn object for editing.