Selction and Keyborad event

I have some questions.

  • How to know if an objects are selected. I want to run the thread if the object is selected, and if not I want to terminate the thread. Is there any event about selection?

  • When some objects are selected, I want it to become a group if I hold down a certain keyboard key, and then become ungroup when I key up.

Q1, Q2 are same problems. I would like to know the state of a particular key pressed while the object is selected.

Please could you reply me.

The User Guide has a lot on Selection and keyboard, but here are the basics:

There is OnGotSelection and OnLostSelection overrides at the GoObject level. Probably not what you want, though.

GoView.Selection returns the GoSelection object, which lets you see what is selected.

GoView also has events for selection changes: ObjectGotSelection, ObjectLostSelection.

For handling key input, look at the Classier sample for DoKeyDown(Object sender, KeyEventArgs evt).

GoDiagram is NOT thread safe. Don’t be manipulating GoObjects from threads.

Not sure what you’re doing here, but this seems kind of odd. Just using the Selection as the “collection” of objects without actually creating a GoGroup may be simpler.