API Reference


Brew Release
Brew MP 1.0.2
See Also
- IContainer Interface
The XY container is derived from the base container object and is used to manage the widgets within a container, where those widgets are positioned within the container at absolute (x, y) locations. The coordinates of each object managed by an XY container are expressed relative to the enclosing container. Therefore, a widget placed at (2, 5) within an XY container would be placed 2 pixels from the container's left edge, and 5 pixels from the top. Objects are positioned by specifying their point of origin, with the object extent entirely under the control of the object itself (unlike objects placed in card, prop or constraint containers, where the container grants an extent to each object).
Objects within an XY container may overlap one another with the widgets at the top of the widget stack being those that appear to lay "on top" of lower objects.
Supported Events: The XY container does not supply its own event handler, deferring all event handling to the base container from which it derives. As such, all events will first be passed to the border event handler where border property events may be handled. The base container will then attempt to process events that set or move the focus, and pass all other events to the widget within the container that currently holds the focus.
The XY container is the simplest container among all available containers. This is becasue,
      1) The XY container does not set extent on its child widget, but relies on the extent
         the application has set on the widget;
      2) The XY container doesn't do any layout. It just depends on the application to insert
         a child at a particular (x, y) position within the widget.
With this simplicity, XY container is also the most efficient, since it doesn't do any layout. There is one problem, though. Since an application needs to explicitly provide the location and size for each child widget, it needs to have logic to layout the screen contents based on screen resolution.
The following sample code shows how a XY container is created and how child widgets are inserted into the XY container.
   int nErr;
   IXYContainer *pIXYContainer = NULL;
   IWidget *pIStaticWidget1 = NULL;
   IWidget *pIStaticWidget2 = NULL;
   WExtent we;
   WidgetPos WidPos;

      nErr = ISHELL_CreateInstance(pIShell, AEECLSID_XYContainer, (void **)&pIXYContainer);

      nErr = ISHELL_CreateInstance(pIShell, AEECLSID_StaticWidget, (void**) &pIStaticWidget1);

      nErr = ISHELL_CreateInstance(pIShell, AEECLSID_StaticWidget, (void**) &pIStaticWidget2);

      we.width = 45;
      we.height = 20;
      IWIDGET_SetExtent(pIStaticWidget1, &we);
      IWIDGET_SetExtent(pIStaticWidget2, &we);

      WidPos.bVisible = 1;
      WidPos.x = 1;
      WidPos.y = 1;
      IXYContainer_Insert(pIXYContainer, pIStaticWidget1, WIDGET_ZNORMAL, &WidPos);

      WidPos.y = 20;
      IXYContainer_Insert(pIXYContainer, pIStaticWidget2, WIDGET_ZNORMAL, &WidPos);


  • Follow