GLG Toolkit, C / C++ API Library  Version 4.5

This group contains functions for handling object selection and other user interaction with the GLG drawing. More...

Detailed Description

This group contains functions for handling object selection and other user interaction with the GLG drawing.

Functions

GlgObject GlgCreateSelection (GlgObject top_vp, GlgRectangle *rectangle, GlgObject selected_vp)
 Returns a list of the objects intersecting a given rectangle. More...
 

Function Documentation

◆ GlgCreateSelection()

GlgObject GlgCreateSelection ( GlgObject  top_vp,
GlgRectangle rectangle,
GlgObject  selected_vp 
)

Returns a list of the objects intersecting a given rectangle.

This function provides a low-level API to determine whether a mouse event was meant to select graphical objects in a drawing, and may be used inside the Trace callback to implement custom handling of mouse events.

Action objects attached to objects in the drawing provide a higher level interface for custom object selection processing.

Parameters
top_vpThe top viewport or light viewport of the selection query (must be an ancestor of selected_vp or the same as selected_vp). It may be either a viewport or a light viewport.
rectangleThe bounding rectangle in screen coordinates of the selected_vp viewport. All graphical shapes whose rendering intersects this rectangle, including shapes in the top_vp viewport, are included in the selection list.
selected_vpThe viewport relatively to which the bounding rectangle is defined. When used with the mouse events, this is the viewport in which the mouse event occurred. If a light viewport is supplied, its parent viewport will be used.
Returns
An array containing object IDs of all selected objects, or NULL if no objects were selected. The returned array must be dereferenced with GlgDropObject when done.

This function is similar to GlgCreateSelectionNames function, but it returns an array of objects instead of an array of object names. The objects in the array are listed in the reversed order compared to their drawing order, so that the objects that are at the bottom of the drawing list and are drawn on top of other objects will be listed first in the array.

While GlgCreateSelectionNames reports both the selected objects on the bottom of the hierarchy and all their parents, this function reports only objects at the bottom and doesn't include their parents. For example, if a polygon in a group is selected, only the polygon is reported and not the group. To get information about the parents of selected objects, use the GlgGetParent function.