(Document and Medical Imaging toolkits)
If more than one object is selected when the right mouse button is pressed, the "Group" menu option appears and lets you group the selected objects. From that moment on, all the grouped objects are acted on as one in automation mode. When you select one object, all objects become selected. When you unselect an object belonging to a group, all objects in that group are unselected.
To select only one object in a group, you must ungroup them. When you select a "grouped" set of objects and press the right mouse button, the "Ungroup" option appears in the menu. Selecting that option "ungroups" the objects. After that, objects are independent (you can select one without selecting the others).
Each container has a "Grouping" property, which determines whether the objects contained in that container are treated as a group by the automation. If the "Grouping" property is TRUE, then all the objects in the container should be treated as a group. If the "Grouping" property is FALSE, then the objects in the container can be selected and changed independently. The "Grouping" property of a container can be set using the L_AnnSetGrouping function. To determine the status of the "Grouping" property of a container, call L_AnnGetGrouping.
L_AnnGroup does the following:
creates a sub-container
moves the objects to this sub-container
sets the Grouping property for the sub-container to TRUE
Setting the Grouping property to FALSE by calling L_AnnSetGrouping with bAutoGroup set to FALSE is similar to calling L_AnnUngroup).
To change only one object within a group, do the following:
find the object's container.
set the grouping property to FALSE for the container.
change the object.
set the grouping property to TRUE for the container.
To programmatically move all the objects belonging to a group you have two choices:
1. Move the subcontainer, which contains all the objects (not the best solution)
2. Move all the objects present in that container (the better solution).
The problem with moving the container is that objects are clipped to their container. So if the subcontainer has an offset of 100 and you try to move the objects in the automated mode, then you cannot move the objects all the way to the left. You will be able to move the objects in the automated mode, but their left side will disappear.
This means that if you are going to use subcontainers and automated mode at the same time, then you should create the subcontainers so that they have the same size as the main container. Or, you can intercept the WM_LTANNEVENT message and keep track of the mouse notifications. And move the subcontainer whenever the mouse moves.
To create a group of objects, you can create a container, insert all the objects in it and insert that container in the main container (without stripping the container).
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET