Using an Existing Widget

Most of the classes that inherit from the IlvView class define a constructor that specifies an existing widget to be used, instead of your having to create one. Here is how to create an IlvView object from a widget:

IlvDisplay* display = ... // display initialization

// Create a DrawingArea widget

Widget drawingArea =

XtVaCreateManagedWidget("ilvview",

xmDrawingAreaWidgetClass, parent,

XmNwidth, 100,

XmNheight, 100,

0);

// Realize this widget

XtRealizeWidget(drawingArea);

// Create a IlvView object from this widget.

IlvView* aView = new IlvView(display, drawingArea);

The only restriction is that the widget you use must already be realized (in the Xt terminology, that is, the widget must have a window) before you call the constructor of IlvView.