Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All,
I have to design a form containing a number of static and text widgets whose size is greater than the screen size. For that I need to add scroll bar to the container. But when I'm calling IDecorator_SetWidget, my code throws me an exception. The code snippet is given below.
If anybody could provide any pointers it would be helpful. My code snippet is given below.

if ((iErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_XYContainer, (void**)&pMe->pIContactbookXYContainer)) != AEE_SUCCESS )
{
return FALSE;
}
if ((iErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_ScrollbarWidget, &pMe->pIScrollBarWidget1)) != AEE_SUCCESS)
{
return FALSE;
}
IWidget_SetScrollStyle(pMe->pIScrollBarWidget1, SCROLL_VERT);
IWidget_SetScrollColor(pMe->pIScrollBarWidget1, MAKE_RGB(0,245,025));
IWidget_SetActiveScrollHandleColor(pMe->pIScrollBarWidget1, MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(pMe->pIScrollBarWidget1, MAKE_RGB(0,0,24));
IWidget_SetActiveScrollColor(pMe->pIScrollBarWidget1, MAKE_RGB(0,0,50));
IWidget_SetInactiveScrollColor(pMe->pIScrollBarWidget1, MAKE_RGB(100,0,120));
IWidget_SetFlags(pMe->pIScrollBarWidget1,3);

IXYContainer_Insert(pMe->pIContactbookXYContainer,pMe->pIScrollBarWidget1,WIDGET_ZBOTTOMMOST,&pWidgetPos);
if ((iErr = IXYContainer_QueryInterface(pMe->pIContactbookXYContainer, AEEIID_IWidget, (void**)&pMe->pIScrollBarQWidget1)) != AEE_SUCCESS)
{
return FALSE;
}

IDecorator_SetWidget((IDecorator*)(void*)pMe->pIScrollBarWidget1, pMe->pIScrollBarQWidget1);

It's failing in the last line.

Any pointers would be helpful.

Thanks
Ambarish

Hey Ambarish,
It loosk like what you really want in order to achieve what you want to do is to use a viewport widget. Please see AEECLSID_ViewportWidget in the API reference for details. So basically:
1. Create the content widget that will use the viewport as a decorator.
2. Call ISHELL_CreateInstance() with a class ID of AEECLSID_ViewportWidget to
retrieve a reference counted instance of the viewport widget.
3. Call IDECORATOR_SetWidget() to attach the viewport as a decorator of the
widget providing the content to be viewed.
-Tony
BMP Apps Eng

Hey Ambarish,
It loosk like what you really want in order to achieve what you want to do is to use a viewport widget. Please see AEECLSID_ViewportWidget in the API reference for details. So basically:
1. Create the content widget that will use the viewport as a decorator.
2. Call ISHELL_CreateInstance() with a class ID of AEECLSID_ViewportWidget to
retrieve a reference counted instance of the viewport widget.
3. Call IDECORATOR_SetWidget() to attach the viewport as a decorator of the
widget providing the content to be viewed.
-Tony
BMP Apps Eng

Hi All,
I'm able to add scroll bar to the container but the issue is at a time either my text and static widgets are visible or the scroll bar is visible. I can not see both at the same time. Only the widget that is set to the IFORM using IForm_SetWidget in the last is visible, i.e. either scroll bar or a text widget.
Can anyone please help.
Thanks,
Ambarish

Hi All,
I'm able to add scroll bar to the container but the issue is at a time either my text and static widgets are visible or the scroll bar is visible. I can not see both at the same time. Only the widget that is set to the IFORM using IForm_SetWidget in the last is visible, i.e. either scroll bar or a text widget.
Can anyone please help.
Thanks,
Ambarish

You want to do something like this:
IDECORATOR_SetWidget(pViewport, pMe->pIContactbookXYContainer);
IDECORATOR_SetWidget(pScrollbar, IDECORATOR_TO_IWIDGET(pViewport));
IFORM_SetWidget(pForm, WID_FORM, IDECORATOR_TO_IWIDGET(pScrollbar));

You want to do something like this:
IDECORATOR_SetWidget(pViewport, pMe->pIContactbookXYContainer);
IDECORATOR_SetWidget(pScrollbar, IDECORATOR_TO_IWIDGET(pViewport));
IFORM_SetWidget(pForm, WID_FORM, IDECORATOR_TO_IWIDGET(pScrollbar));

Hi Erik,
pViewPort and pScrollBar are already widgets. How can I use IDECORATOR_TO_IWIDGET.
Using it anyways also doesn't solve the problems.
Both the screen and scrollBar are visible only after I use IForm_SetWidget after using IRootForm_PushForm. But it's giving me problem in handling the widgets.
Also the key events are being handled by both the forms one after other.
Any pointers?
Thanks,
Ambarish

Hi Erik,
pViewPort and pScrollBar are already widgets. How can I use IDECORATOR_TO_IWIDGET.
Using it anyways also doesn't solve the problems.
Both the screen and scrollBar are visible only after I use IForm_SetWidget after using IRootForm_PushForm. But it's giving me problem in handling the widgets.
Also the key events are being handled by both the forms one after other.
Any pointers?
Thanks,
Ambarish

Ambarish,
In your case you wouldn t need to use IDecorator_to_IWidget since you already have a IWidget*, but in Erik s snippet pScrollbar is a IDecorator*, which would necessitate the cast.
As far as getting your XY container to be scrollable, you need to decorate it with a Viewport widget (a decorator widget). The reason for this is that an XY container does not know how to handle the scroll events & a Viewport widget does. In your code you will have the XY container that is wrapped (decorated) by a Viewport widget that is wrapped by a scrollbar widget. You would then use the IWidget pointer from the scrollbar as the primary widget (WID_FORM) for the form. This is what Erik s snippet is doing. Also you should ensure that the extent is being set for the container, the viewport and the scrollbar, so that it shows up as you expect.
Here s a snippet along the same line as Erik s. Hope this helps.
-J. Ford
WidgetPos dwpos;
IWidget *piwViewport = 0;
IWidget *piwXY = 0;
IDecorator *pidScrollbar = 0;
int nErr;
WidgetExtent we;
// create viewport widget since it handles scroll events
nErr = ISHELL_CreateInstance(me->pIShell, AEECLSID_ViewportWidget, (void**)&piwViewport);
if (AEE_SUCCESS != nErr) {
return nErr;
}
// create the scrollbar widget
nErr = ISHELL_CreateInstance(me->pIShell, AEECLSID_ScrollbarWidget, (void**)&pidScrollbar);
if (AEE_SUCCESS != nErr) {
return nErr;
}
// set extent for the XY Container
we.height = XYHEIGHT; // the height of the container is larger than the display.
we.width = me->DeviceInfo.cxScreen;
IXYContainer_QueryInterface(me->piXY, AEEIID_IWidget, &piwXY);
IWIDGET_SetExtent(piwXY, &we);
// wrap the viewport around the XY Container
IDecorator_SetWidget((IDecorator*)(void*)piwViewport, piwXY);
// adjust the scroll increment. default is 1 pixel.
IWIDGET_SetIncrement(piwViewport, 10);
// set extent for the viewport
we.width = (me->DeviceInfo).cxScreen - 2;
we.height = (me->DeviceInfo).cyScreen;
IWIDGET_SetExtent(piwViewport, &we);
// wrap the scrollbar around the viewport
IDecorator_SetWidget(pidScrollbar, piwViewport);
// tailor the scrollbar look & extent
IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar), SCROLL_VERT);
IWidget_SetScrollColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(0,245,025));
IWidget_SetActiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(0,0,24));
IWidget_SetActiveScrollColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(0,0,50));
IWidget_SetInactiveScrollColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(100,0,120));
IWidget_SetFlags(IDecorator_to_IWidget(pidScrollbar), 3);
IWIDGET_SetExtent(IDecorator_to_IWidget(pidScrollbar), &we);
// insert widget into root container
dwpos.x = 0;
dwpos.y = 0;
dwpos.bVisible = TRUE;
(void)IROOTCONTAINER_Insert(me->picRoot, IDecorator_to_IWidget(pidScrollbar), WIDGET_ZNORMAL,&dwpos);

Ambarish,
In your case you wouldn t need to use IDecorator_to_IWidget since you already have a IWidget*, but in Erik s snippet pScrollbar is a IDecorator*, which would necessitate the cast.
As far as getting your XY container to be scrollable, you need to decorate it with a Viewport widget (a decorator widget). The reason for this is that an XY container does not know how to handle the scroll events & a Viewport widget does. In your code you will have the XY container that is wrapped (decorated) by a Viewport widget that is wrapped by a scrollbar widget. You would then use the IWidget pointer from the scrollbar as the primary widget (WID_FORM) for the form. This is what Erik s snippet is doing. Also you should ensure that the extent is being set for the container, the viewport and the scrollbar, so that it shows up as you expect.
Here s a snippet along the same line as Erik s. Hope this helps.
-J. Ford
WidgetPos dwpos;
IWidget *piwViewport = 0;
IWidget *piwXY = 0;
IDecorator *pidScrollbar = 0;
int nErr;
WidgetExtent we;
// create viewport widget since it handles scroll events
nErr = ISHELL_CreateInstance(me->pIShell, AEECLSID_ViewportWidget, (void**)&piwViewport);
if (AEE_SUCCESS != nErr) {
return nErr;
}
// create the scrollbar widget
nErr = ISHELL_CreateInstance(me->pIShell, AEECLSID_ScrollbarWidget, (void**)&pidScrollbar);
if (AEE_SUCCESS != nErr) {
return nErr;
}
// set extent for the XY Container
we.height = XYHEIGHT; // the height of the container is larger than the display.
we.width = me->DeviceInfo.cxScreen;
IXYContainer_QueryInterface(me->piXY, AEEIID_IWidget, &piwXY);
IWIDGET_SetExtent(piwXY, &we);
// wrap the viewport around the XY Container
IDecorator_SetWidget((IDecorator*)(void*)piwViewport, piwXY);
// adjust the scroll increment. default is 1 pixel.
IWIDGET_SetIncrement(piwViewport, 10);
// set extent for the viewport
we.width = (me->DeviceInfo).cxScreen - 2;
we.height = (me->DeviceInfo).cyScreen;
IWIDGET_SetExtent(piwViewport, &we);
// wrap the scrollbar around the viewport
IDecorator_SetWidget(pidScrollbar, piwViewport);
// tailor the scrollbar look & extent
IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar), SCROLL_VERT);
IWidget_SetScrollColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(0,245,025));
IWidget_SetActiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(0,0,24));
IWidget_SetActiveScrollColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(0,0,50));
IWidget_SetInactiveScrollColor(IDecorator_to_IWidget(pidScrollbar), MAKE_RGB(100,0,120));
IWidget_SetFlags(IDecorator_to_IWidget(pidScrollbar), 3);
IWIDGET_SetExtent(IDecorator_to_IWidget(pidScrollbar), &we);
// insert widget into root container
dwpos.x = 0;
dwpos.y = 0;
dwpos.bVisible = TRUE;
(void)IROOTCONTAINER_Insert(me->picRoot, IDecorator_to_IWidget(pidScrollbar), WIDGET_ZNORMAL,&dwpos);

Hi All,
I have a form with anumber of text widgets and a scrollbar. The issue is when I start pressing the AVK_DOWN key, first the scrollbar moves completely, then my text widgets start getting focus.
If I set the viewports property PROP_INCREMENT to 0, then my text widgets get focus, but even if the focus moves out of the page, the page does not starts scrolling.
I have checked by calling IRootForm_HandleEvent as well as IForm_HandleEvent giving it the pointer to the form which contains the text widgets. Still the same problem persists.
Please note that I have inserted the scrollbar widget in the RootContainer and my rest of widgets are on XYContainer.
Any pointers would be helpful.
Thanks,
Ambarish

Hi All,
I have a form with anumber of text widgets and a scrollbar. The issue is when I start pressing the AVK_DOWN key, first the scrollbar moves completely, then my text widgets start getting focus.
If I set the viewports property PROP_INCREMENT to 0, then my text widgets get focus, but even if the focus moves out of the page, the page does not starts scrolling.
I have checked by calling IRootForm_HandleEvent as well as IForm_HandleEvent giving it the pointer to the form which contains the text widgets. Still the same problem persists.
Please note that I have inserted the scrollbar widget in the RootContainer and my rest of widgets are on XYContainer.
Any pointers would be helpful.
Thanks,
Ambarish

Set the VWF_DISABLEKEYHANDLING flag on the viewport to keep it from scrolling on key presses. You will have to scroll the viewport yourself when the focus moves to a widget that is offscreen. Use IWIDGET_SetOffsetY() to scroll the viewport.

Set the VWF_DISABLEKEYHANDLING flag on the viewport to keep it from scrolling on key presses. You will have to scroll the viewport yourself when the focus moves to a widget that is offscreen. Use IWIDGET_SetOffsetY() to scroll the viewport.

...

...

I am trying to insert Scrollbar to the Root container.. I  am using code oif ambarish but i am unable to get scrollbar here is the snippet
WidgetPos dwpos;    //WExtent we;    WExtent oldwe;    IWidget *piwViewport=0;
 
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ROOTCONTAINER, (void *)(&pMe->picRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Query interface to root containers widget:
nErr = IROOTCONTAINER_QueryInterface(pMe->picRoot, AEEIID_WIDGET, (void *)(&pMe->piwRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

if (SUCCESS == nErr) {
nErr = IWidget_EnableTouch(pMe->piwRoot);
}

// Get the device bitmap
nErr = IDISPLAY_GetDeviceBitmap(pMe->piDisplay, &pib);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Set the root container extent, and get display canvas:
{
AEEBitmapInfo biDevice;
(void)IBITMAP_GetInfo(pib, &biDevice, sizeof(biDevice));
SETAEERECT(&(pMe->rcRoot), 0, 0, (short) biDevice.cx, (short) biDevice.cy);
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_DISPLAYCANVAS,

(void**)&(pMe->piCanvas));
if (AEE_SUCCESS != nErr) {
IBITMAP_Release(pib);
return (nErr);
}
}

nErr = IDISPLAYCANVAS_SetDisplay((IDisplayCanvas*)(void *)pMe->piCanvas, pMe->piDisplay);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

IROOTCONTAINER_SetCanvas(pMe->picRoot, pMe->piCanvas, &(pMe->rcRoot));

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ViewportWidget,(void**)&piwViewport);
if(AEE_SUCCESS!=nErr){
return nErr;
}

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ScrollbarWidget,(void**)&pidScrollbar);
if(AEE_SUCCESS!=nErr){
return nErr;
}

we.height=pMe->deviceInfo.cyScreen;
we.width=pMe->deviceInfo.cxScreen;
IROOTCONTAINER_QueryInterface(pMe->picRoot, AEEIID_WIDGET, (void *)(&pMe->piwRoot));

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget((IDecorator *)(void *)piwViewport,pMe->piwRoot);

IWIDGET_SetIncrement(piwViewport,10);

we.width=(pMe->deviceInfo).cxScreen -2;
we.height=(pMe->deviceInfo).cyScreen;

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget(pidScrollbar,piwViewport);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),SCROLL_VERT);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,245,025));

IWidget_SetActiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,0,24));
IWidget_SetActiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,0,50));
//IWidget_SetInActiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(100,0,120));
IWidget_SetFlags(IDecorator_to_IWidget(pidScrollbar),3);
IWidget_SetExtent(IDecorator_to_IWidget(pidScrollbar),&we);

dwpos.x=10;
dwpos.y=10;
dwpos.bVisible=TRUE;
(void)IROOTCONTAINER_Insert(pMe->picRoot,IDecorator_to_IWidget(pidScrollbar),WIDGET_ZNORMAL,&dwpos);     There is no ERROR but i am not getting out put also Please any one help me...

I am trying to insert Scrollbar to the Root container.. I  am using code oif ambarish but i am unable to get scrollbar here is the snippet
WidgetPos dwpos;    //WExtent we;    WExtent oldwe;    IWidget *piwViewport=0;
 
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ROOTCONTAINER, (void *)(&pMe->picRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Query interface to root containers widget:
nErr = IROOTCONTAINER_QueryInterface(pMe->picRoot, AEEIID_WIDGET, (void *)(&pMe->piwRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

if (SUCCESS == nErr) {
nErr = IWidget_EnableTouch(pMe->piwRoot);
}

// Get the device bitmap
nErr = IDISPLAY_GetDeviceBitmap(pMe->piDisplay, &pib);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Set the root container extent, and get display canvas:
{
AEEBitmapInfo biDevice;
(void)IBITMAP_GetInfo(pib, &biDevice, sizeof(biDevice));
SETAEERECT(&(pMe->rcRoot), 0, 0, (short) biDevice.cx, (short) biDevice.cy);
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_DISPLAYCANVAS,

(void**)&(pMe->piCanvas));
if (AEE_SUCCESS != nErr) {
IBITMAP_Release(pib);
return (nErr);
}
}

nErr = IDISPLAYCANVAS_SetDisplay((IDisplayCanvas*)(void *)pMe->piCanvas, pMe->piDisplay);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

IROOTCONTAINER_SetCanvas(pMe->picRoot, pMe->piCanvas, &(pMe->rcRoot));

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ViewportWidget,(void**)&piwViewport);
if(AEE_SUCCESS!=nErr){
return nErr;
}

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ScrollbarWidget,(void**)&pidScrollbar);
if(AEE_SUCCESS!=nErr){
return nErr;
}

we.height=pMe->deviceInfo.cyScreen;
we.width=pMe->deviceInfo.cxScreen;
IROOTCONTAINER_QueryInterface(pMe->picRoot, AEEIID_WIDGET, (void *)(&pMe->piwRoot));

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget((IDecorator *)(void *)piwViewport,pMe->piwRoot);

IWIDGET_SetIncrement(piwViewport,10);

we.width=(pMe->deviceInfo).cxScreen -2;
we.height=(pMe->deviceInfo).cyScreen;

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget(pidScrollbar,piwViewport);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),SCROLL_VERT);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,245,025));

IWidget_SetActiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,0,24));
IWidget_SetActiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,0,50));
//IWidget_SetInActiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(100,0,120));
IWidget_SetFlags(IDecorator_to_IWidget(pidScrollbar),3);
IWidget_SetExtent(IDecorator_to_IWidget(pidScrollbar),&we);

dwpos.x=10;
dwpos.y=10;
dwpos.bVisible=TRUE;
(void)IROOTCONTAINER_Insert(pMe->picRoot,IDecorator_to_IWidget(pidScrollbar),WIDGET_ZNORMAL,&dwpos);     There is no ERROR but i am not getting out put also Please any one help me...

Root container is a top level container which is responsible for displaying all other widgets. You cannot wrap root with decorators like scrollbar. Create one more container having widgets to display and add scrollbar to it.

Root container is a top level container which is responsible for displaying all other widgets. You cannot wrap root with decorators like scrollbar. Create one more container having widgets to display and add scrollbar to it.

Thanks adhudase,
            after creating root container i've reated XY container an tried to insert Scroll bar widget to XY container but still i am not getting any scroll bar still screen is blank please do help
 

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ROOTCONTAINER, (void *)(&pMe->picRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Query interface to root containers widget:
nErr = IROOTCONTAINER_QueryInterface(pMe->picRoot, AEEIID_WIDGET, (void *)(&pMe->piwRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

if (SUCCESS == nErr) {
nErr = IWidget_EnableTouch(pMe->piwRoot);
}

// Get the device bitmap
nErr = IDISPLAY_GetDeviceBitmap(pMe->piDisplay, &pib);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Set the root container extent, and get display canvas:
{
AEEBitmapInfo biDevice;
(void)IBITMAP_GetInfo(pib, &biDevice, sizeof(biDevice));
SETAEERECT(&(pMe->rcRoot), 0, 0, (short) biDevice.cx, (short) biDevice.cy);
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_DISPLAYCANVAS,

(void**)&(pMe->piCanvas));
if (AEE_SUCCESS != nErr) {
IBITMAP_Release(pib);
return (nErr);
}
}

nErr = IDISPLAYCANVAS_SetDisplay((IDisplayCanvas*)(void *)pMe->piCanvas, pMe->piDisplay);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

IROOTCONTAINER_SetCanvas(pMe->picRoot, pMe->piCanvas, &(pMe->rcRoot));
// (void) IWidget_SetBGColor(pMe->piwRoot, RGB_TEAL);

if (AEE_SUCCESS != ISHELL_CreateInstance(pMe->piShell, AEECLSID_XYContainer, (void **)&pMe->picXYCon)) {
pMe->picXYCon = NULL;
return FALSE;
}

// get the widget interface for the XY container
if (AEE_SUCCESS != IXYContainer_QueryInterface(pMe->picXYCon, AEEIID_IWidget, &piwXY)) {
return FALSE;
}

// set the extent for the XY container
we.width =0 ;
we.height = 0;
IWidget_SetExtent(piwXY, &we);

// set the position of the XY container in the root container
dwpos.x = 20;
dwpos.y = 20;
dwpos.bVisible = TRUE;

// insert the XY container in the root container
if (AEE_SUCCESS != IRootContainer_Insert(pMe->picRoot,piwXY, WIDGET_ZNORMAL, &dwpos)) {
return FALSE;
}

//--------------------------------------------------------------------------------

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ViewportWidget,(void**)&piwViewport);
if(AEE_SUCCESS!=nErr){
return nErr;
}

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ScrollbarWidget,(void**)&pidScrollbar);
if(AEE_SUCCESS==nErr){
DBGPRINTF("HHHHHI");
//return nErr;
}

we.height=pMe->deviceInfo.cyScreen;
we.width=pMe->deviceInfo.cxScreen;

IXYContainer_QueryInterface(pMe->picXYCon,AEEIID_IWidget,&piwXY);

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget((IDecorator *)(void *)piwViewport,piwXY);

IWIDGET_SetIncrement(piwViewport,10);

we.width=(pMe->deviceInfo).cxScreen -2;
we.height=(pMe->deviceInfo).cyScreen;

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget(pidScrollbar,piwViewport);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),SCROLL_VERT);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,245,025));

IWidget_SetActiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(255,0,0));
IWidget_SetActiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,0,50));
IWidget_SetInactiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(100,0,120));
IWidget_SetFlags(IDecorator_to_IWidget(pidScrollbar),3);
IWidget_SetExtent(IDecorator_to_IWidget(pidScrollbar),&we);

dwpos.x=30;
dwpos.y=30;
dwpos.bVisible=TRUE;
nErr=IROOTCONTAINER_Insert(pMe->picRoot,IDecorator_to_IWidget(pidScrollbar),WIDGET_ZNORMAL,&dwpos);
return TRUE;}

Thanks adhudase,
            after creating root container i've reated XY container an tried to insert Scroll bar widget to XY container but still i am not getting any scroll bar still screen is blank please do help
 

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ROOTCONTAINER, (void *)(&pMe->picRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Query interface to root containers widget:
nErr = IROOTCONTAINER_QueryInterface(pMe->picRoot, AEEIID_WIDGET, (void *)(&pMe->piwRoot));
if (AEE_SUCCESS != nErr) {
return (nErr);
}

if (SUCCESS == nErr) {
nErr = IWidget_EnableTouch(pMe->piwRoot);
}

// Get the device bitmap
nErr = IDISPLAY_GetDeviceBitmap(pMe->piDisplay, &pib);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

// Set the root container extent, and get display canvas:
{
AEEBitmapInfo biDevice;
(void)IBITMAP_GetInfo(pib, &biDevice, sizeof(biDevice));
SETAEERECT(&(pMe->rcRoot), 0, 0, (short) biDevice.cx, (short) biDevice.cy);
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_DISPLAYCANVAS,

(void**)&(pMe->piCanvas));
if (AEE_SUCCESS != nErr) {
IBITMAP_Release(pib);
return (nErr);
}
}

nErr = IDISPLAYCANVAS_SetDisplay((IDisplayCanvas*)(void *)pMe->piCanvas, pMe->piDisplay);
if (AEE_SUCCESS != nErr) {
return (nErr);
}

IROOTCONTAINER_SetCanvas(pMe->picRoot, pMe->piCanvas, &(pMe->rcRoot));
// (void) IWidget_SetBGColor(pMe->piwRoot, RGB_TEAL);

if (AEE_SUCCESS != ISHELL_CreateInstance(pMe->piShell, AEECLSID_XYContainer, (void **)&pMe->picXYCon)) {
pMe->picXYCon = NULL;
return FALSE;
}

// get the widget interface for the XY container
if (AEE_SUCCESS != IXYContainer_QueryInterface(pMe->picXYCon, AEEIID_IWidget, &piwXY)) {
return FALSE;
}

// set the extent for the XY container
we.width =0 ;
we.height = 0;
IWidget_SetExtent(piwXY, &we);

// set the position of the XY container in the root container
dwpos.x = 20;
dwpos.y = 20;
dwpos.bVisible = TRUE;

// insert the XY container in the root container
if (AEE_SUCCESS != IRootContainer_Insert(pMe->picRoot,piwXY, WIDGET_ZNORMAL, &dwpos)) {
return FALSE;
}

//--------------------------------------------------------------------------------

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ViewportWidget,(void**)&piwViewport);
if(AEE_SUCCESS!=nErr){
return nErr;
}

nErr=ISHELL_CreateInstance(pMe->piShell,AEECLSID_ScrollbarWidget,(void**)&pidScrollbar);
if(AEE_SUCCESS==nErr){
DBGPRINTF("HHHHHI");
//return nErr;
}

we.height=pMe->deviceInfo.cyScreen;
we.width=pMe->deviceInfo.cxScreen;

IXYContainer_QueryInterface(pMe->picXYCon,AEEIID_IWidget,&piwXY);

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget((IDecorator *)(void *)piwViewport,piwXY);

IWIDGET_SetIncrement(piwViewport,10);

we.width=(pMe->deviceInfo).cxScreen -2;
we.height=(pMe->deviceInfo).cyScreen;

IWIDGET_SetExtent(piwViewport,&we);

IDecorator_SetWidget(pidScrollbar,piwViewport);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),SCROLL_VERT);

IWidget_SetScrollStyle(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,245,025));

IWidget_SetActiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(255,0,0));
IWidget_SetInactiveScrollHandleColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(255,0,0));
IWidget_SetActiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(0,0,50));
IWidget_SetInactiveScrollColor(IDecorator_to_IWidget(pidScrollbar),MAKE_RGB(100,0,120));
IWidget_SetFlags(IDecorator_to_IWidget(pidScrollbar),3);
IWidget_SetExtent(IDecorator_to_IWidget(pidScrollbar),&we);

dwpos.x=30;
dwpos.y=30;
dwpos.bVisible=TRUE;
nErr=IROOTCONTAINER_Insert(pMe->picRoot,IDecorator_to_IWidget(pidScrollbar),WIDGET_ZNORMAL,&dwpos);
return TRUE;}