Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Creating a container

The c_simple_widget application uses an XY container to hold the widgets, which is created in c_simple_widget_app_CreateWidgets().

An application can create an XY container as follows:

  1. Call ISHELL_CreateInstance() to create the container:
    	if (AEE_SUCCESS != ISHELL_CreateInstance(pMe->piShell, 
                AEECLSID_CXYContainer, (void **)&pMe->picXYCon)) {
     		pMe->picXYCon = NULL;
     		return FALSE;
    }
  2. Call IXYContainer_QueryInterface() to get the widget interface for the XY container. For example:
    if (AEE_SUCCESS != IXYContainer_QueryInterface(pMe->picXYCon,
                AEEIID_IWidget, (void**)&pMe->piwXYCon)) {
     		pMe->piwXYCon = NULL;
     		return FALSE;
    }
  3. Set the extent of the XY container by setting the height and width in a WidgetExtent structure and calling IWidget_SetExtent() with pointers to the XY container and the WidgetExtent structure. In this example, the XY container size is based on the size of the root container.
    we.width = pMe->rootcontainerwidth - 40;
    we.height = pMe->rootcontainerheight - 40;
    
    IWidget_SetExtent(pMe->piwXYCon, &we);
  4. Set the position of the XY container in a WidgetPos structure, and set bVisible to TRUE so that the container will be visible on the display. Then call IRootContainer_Insert() to insert the XY container in the root container. For example:
    dwpos.x = 20;
    dwpos.y = 20;
    dwpos.bVisible = TRUE;
    
    if (AEE_SUCCESS != IRootContainer_Insert(pMe->picRoot, pMe->piwXYCon,
                WIDGET_ZNORMAL, &dwpos)) {
    		 return FALSE;
    }