This example (demoPrograms\engine\VC#\control or demoPrograms\engine\VB\control) demonstrates how to control an interactive operator from the user application, such as suppressing the normal menu and pop-up panel provided by WiT Engine.

Interactive Operator Control
In this example, you are prompted to enter a variety of graphic objects on top of an image. When you are satisfied with the graphic objects, hit the OK button, and the number of objects is reported. Then if you hit the Next Set button, you are prompted to enter a second set of graphic objects. The first set is still maintained but can no longer be deleted or modified. Keep on hitting OK and Next Set to enter more graphics and the total number of objects will be reported each time. Press Stop to stop the editing session.

Interactive Operator Control Igraph
The getData2 operator’s display is mapped as usual using SetDisplayWnd. SetDisplayActiveCallback is used to ensure that getDataActive is called whenever getData2 is created. SetControlDisplay is used to suppress the getData2 operator’s pop-up menu and Graphics Editor panel. SetStateCallback2 is used to ensure that execStateNotify is called whenever the igraph execution state changes.
[C#]
WiT.engine.SetDisplayWnd("getData2", imageBox.Handle);
WiT.engine.ControlDisplay("getData2", "suppressPopupMenu 1");
myDspActCallback = new WiT.engine.displayActiveCB(getDataActive);
WiT.engine.SetDisplayActiveCallback("getData2", myDspActCallback);
myStateCallback = new WiT.engine.stateCB2(execStateNotify);
WiT.engine.SetStateCallback2(myStateCallback);
[Visual Basic]
WiT.engine.SetDisplayWnd("getData2", ImageBox.Handle)
WiT.engine.ControlDisplay("getData2", "suppressPopupMenu 1")
myDspActCallback = New WiT.engine.displayActiveCB(AddressOf _
getDataActive)
WiT.engine.SetDisplayActiveCallback("getData2", myDspActCallback)
myStateCallback = New WiT.engine.stateCB2(AddressOf execStateNotify)
WiT.engine.SetStateCallback2(myStateCallback)
SetDisplayWnd and SetDisplayActiveCallback are used to ensure that nextSetActive is called whenever the prompt operator named ‘NextSet’ is created, which suppresses display of the normal pop-up dialog. This way the user can control when to move on to the next set of inputs.
[C#]
WiT.engine.SetDisplayWnd("NextSet", 0);
nextDspActCallback = new WiT.engine.displayActiveCB(nextSetActive);
WiT.engine.SetDisplayActiveCallback("NextSet", nextDspActCallback);
[Visual Basic]
WiT.engine.SetDisplayWnd("NextSet", Convert.ToUInt32(0))
nextDspActCallback = New WiT.engine.displayActiveCB(AddressOf _
nextSetActive)
WiT.engine.SetDisplayActiveCallback("NextSet", nextDspActCallback)
Load and ControlExec are used to load and run the chosen WIC. When getData2 is run, getDataActive is called and all the appropriate buttons are enabled. User inputs to getData2 can be executed the normal way using the mouse.
This example also demonstrates the use of commands like OK, Stop, Select, Line, Constrast, etc., with the ControlDisplay function to execute various actions for the getData2 operator. See the methods reference section for details concerning the operation of ControlDisplay.