void Get_Selection (char *segment)
 Performs all the work needed to have the user point at something on the screen. More...

Detailed Description

Function Documentation

◆ Get_Selection()

void Get_Selection ( char *  segment)

Performs all the work needed to have the user point at something on the screen.

segment- The "simple" name—not including the segment's owner, the owner's owner, and so on—of the segment that includes the window or piece of geometry selected. Passed by reference always. Returned to user.


Get_Selection() is a utility routine that combines a common sequence of input routines. The sequence does the work necessary to attach a pointing device to the screen. The sequence waits for the user to select something, puts the system back the way it was, and returns the name of the selected segment.
In pseudo-C, Get_Selection() corresponds to the following:

        Enable_Selection_Events ("?locater", "?Picture") 
        do Await_Event (&type) 
        until (strcmp (type, "selection") == 0) 
        Disable_Selection_Events ("?locater", "?Picture") 
        Show_Selection (&segment)

The "segment" is then returned to the original caller. The various Show Selection routines can then be called to gain extra information about the selected item.


Get_Selection() updates the display, courtesy of Await_Event() .
Get_Selection() does not verify that the event received matches the type of selection event enabled.
Get_Selection() and Show_Selection() both return the same information to your program. Get_Selection() is a high-level routine that does a variety of work. Show_Selection() is a low-level routine whose only function is to extract one existing piece of information from the database.
If the segment selected was originally created as a "no-name" segment, then the string returned will be in form of "@hex", where "hex" is the hexadecimal encoding of the segment's key. Note that this style of segment name is acceptable as input back into HOOPS.


See also
Await_Event, Show_Selection, Enable_Selection_Events, Show_Selection_Element, Show_Selection_Position, Show_Selection_Pathname, Show_Selection_Source, Set_Selectability, Compute_Selection, Requeue_Event.