How to add scrollbar | developer.brewmp.com How to add scrollbar | developer.brewmp.com

Developer

How to add scrollbar

Hi

I wanna know that how can we add a scrollbar on a form which have multiple widgets(all widgets are inserted in a constraint container so in other words how to add scrollbar in a constraint container) .I have read steps on different threads but i want a sample code as i could not implement these steps.
Kindly help me .

Try the following steps.I guess it will work.
Get container's widget by calling ICONSTRAINTCONTAINER_QueryInterface()
Set the scroll bar to the container's widget by calling IDECORATOR_SetWidget()
Regards,
Ramakrishna.

Try the following steps.I guess it will work.
Get container's widget by calling ICONSTRAINTCONTAINER_QueryInterface()
Set the scroll bar to the container's widget by calling IDECORATOR_SetWidget()
Regards,
Ramakrishna.

this is how i am attaching a scrollbar with constraint container widget.
result=ISHELL_CreateInstance(pIShell, AEECLSID_SCROLLBARWIDGET, (void**)&pIScrollBar );
if(result!=SUCCESS)goto error;
IDECORATOR_SetWidget((IDecorator*)pIScrollBar, pIConstraintContainerWidget);
widgetContraint.constraint.top.type = CONSTRAINT_PARENT_TOP;
widgetContraint.constraint.top.offset = 0;
widgetContraint.constraint.left.type = CONSTRAINT_PARENT_LEFT;
widgetContraint.constraint.left.offset = 0;
widgetContraint.constraint.right.type = CONSTRAINT_PARENT_RIGHT;
widgetContraint.constraint.right.offset = 0;
widgetContraint.constraint.bottom.type =CONSTRAINT_PARENT_BOTTOM;
widgetContraint.constraint.bottom.offset = 0;
widgetContraint.bVisible = TRUE;
result = ICONSTRAINTCONTAINER_Insert( pIConstraintContainer, pIScrollBar ,WIDGET_ZNORMAL, &widgetContraint);

this is how i am attaching a scrollbar with constraint container widget.
result=ISHELL_CreateInstance(pIShell, AEECLSID_SCROLLBARWIDGET, (void**)&pIScrollBar );
if(result!=SUCCESS)goto error;
IDECORATOR_SetWidget((IDecorator*)pIScrollBar, pIConstraintContainerWidget);
widgetContraint.constraint.top.type = CONSTRAINT_PARENT_TOP;
widgetContraint.constraint.top.offset = 0;
widgetContraint.constraint.left.type = CONSTRAINT_PARENT_LEFT;
widgetContraint.constraint.left.offset = 0;
widgetContraint.constraint.right.type = CONSTRAINT_PARENT_RIGHT;
widgetContraint.constraint.right.offset = 0;
widgetContraint.constraint.bottom.type =CONSTRAINT_PARENT_BOTTOM;
widgetContraint.constraint.bottom.offset = 0;
widgetContraint.bVisible = TRUE;
result = ICONSTRAINTCONTAINER_Insert( pIConstraintContainer, pIScrollBar ,WIDGET_ZNORMAL, &widgetContraint);

Hello Pooja,
Try these steps to add a scrollbar to the form and to make it scrollable
1) Get the container widget by using the
ICONSTRAINTCONTAINER_QueryInterface(pConstaintContainer, AEEIID_WIDGET, (void**)&pContainerWidget);
2) Create the Scroll widget by
ISHELL_CreateInstance(pShell, AEECLSID_SCROLLBARWIDGET,(void**)&pScrollwidget);
3) Add the container widget in the scroll widget by
IDECORATOR_SetWidget((IDecorator*)pScrollWidget, pContainerWidget);
4) Set the scroll widget to the form by
IFORM_SetWidget(pForm,WID_FORM, pScrollWidget);
This will definately work with the case
if it does not work then
1) create the viewport widget
2) add container widget to the viewport widget
3) add viewport widget to the scroll widget
4) and finally set the scroll widget to the forms WID_FORM
You will see the scrollbar on the form :)
Lalitkumar...

Hello Pooja,
Try these steps to add a scrollbar to the form and to make it scrollable
1) Get the container widget by using the
ICONSTRAINTCONTAINER_QueryInterface(pConstaintContainer, AEEIID_WIDGET, (void**)&pContainerWidget);
2) Create the Scroll widget by
ISHELL_CreateInstance(pShell, AEECLSID_SCROLLBARWIDGET,(void**)&pScrollwidget);
3) Add the container widget in the scroll widget by
IDECORATOR_SetWidget((IDecorator*)pScrollWidget, pContainerWidget);
4) Set the scroll widget to the form by
IFORM_SetWidget(pForm,WID_FORM, pScrollWidget);
This will definately work with the case
if it does not work then
1) create the viewport widget
2) add container widget to the viewport widget
3) add viewport widget to the scroll widget
4) and finally set the scroll widget to the forms WID_FORM
You will see the scrollbar on the form :)
Lalitkumar...

Now i can see the scroll bar on the form when i set its flag to SBWF_NOAUTOHIDE but it is NOT scrolling when I press down key.Now what should I do?

Now i can see the scroll bar on the form when i set its flag to SBWF_NOAUTOHIDE but it is NOT scrolling when I press down key.Now what should I do?

you probably need to set an event handler to your decorator, check out the function IDECORATOR_SetHandler()

you probably need to set an event handler to your decorator, check out the function IDECORATOR_SetHandler()

i have implemented scrollbar using viewport. It is also showing Scrollbar on the screen but the scrollbar is still not giving any scrolling effect.here is the code ..
result=ISHELL_CreateInstance(pIShell, AEECLSID_VIEWPORTWIDGET, (void**)&pIPVWidget );
if(result!=SUCCESS)goto error;
result=ISHELL_CreateInstance(pIShell, AEECLSID_SCROLLBARWIDGET, (void**)&pIScrollBar );
if(result!=SUCCESS)goto error;
IWIDGET_GetExtent(pIConstraintContainerWidget,&extent);
IWIDGET_SetExtent(pIPVWidget,&extent);
IWIDGET_SetFlags(pIScrollBar,SBWF_NOAUTOHIDE|SBWF_ARROWS|SCROLL_VERT|SBWF_FOCUSTRACK);
IWIDGET_SetProperty(pIScrollBar, PROP_SCROLLPAD, 0);
IDECORATOR_SetWidget((IDecorator*)pIPVWidget, pIConstraintContainerWidget);
IDECORATOR_SetWidget((IDecorator*)pIScrollBar, pIPVWidget);
IFORM_SetWidget((IForm*)pThis->pIAccountSettingForm, WID_FORM, pIScrollBar);

i have implemented scrollbar using viewport. It is also showing Scrollbar on the screen but the scrollbar is still not giving any scrolling effect.here is the code ..
result=ISHELL_CreateInstance(pIShell, AEECLSID_VIEWPORTWIDGET, (void**)&pIPVWidget );
if(result!=SUCCESS)goto error;
result=ISHELL_CreateInstance(pIShell, AEECLSID_SCROLLBARWIDGET, (void**)&pIScrollBar );
if(result!=SUCCESS)goto error;
IWIDGET_GetExtent(pIConstraintContainerWidget,&extent);
IWIDGET_SetExtent(pIPVWidget,&extent);
IWIDGET_SetFlags(pIScrollBar,SBWF_NOAUTOHIDE|SBWF_ARROWS|SCROLL_VERT|SBWF_FOCUSTRACK);
IWIDGET_SetProperty(pIScrollBar, PROP_SCROLLPAD, 0);
IDECORATOR_SetWidget((IDecorator*)pIPVWidget, pIConstraintContainerWidget);
IDECORATOR_SetWidget((IDecorator*)pIScrollBar, pIPVWidget);
IFORM_SetWidget((IForm*)pThis->pIAccountSettingForm, WID_FORM, pIScrollBar);

There are two cases
1) By default the scroll bar is auto hide . It means that it will appera only if the data wraped in it is scrollable , i.e if all tha data is visible at a time then the scroll bar will not appear
2) if your form is not all visible i.e Some widgets are partially visible then only the scroll bar appear , in short if the extent of the form to be displayed is larger that the screen size then the scroll bar will appear and on press Up ,down (and/or Left ,Right) it will scroll.
I will suggest to check the data in the contaire or just try to add some more data or increate the extent of the child widgets contained in the container
One more thing if you are getting the extent of thw container widget by IWIDGET_GetExtent() Then just make sure whether it returns the proper value or not . I hope it is not returning the proper value in your case ...
Regards,
Lalit

There are two cases
1) By default the scroll bar is auto hide . It means that it will appera only if the data wraped in it is scrollable , i.e if all tha data is visible at a time then the scroll bar will not appear
2) if your form is not all visible i.e Some widgets are partially visible then only the scroll bar appear , in short if the extent of the form to be displayed is larger that the screen size then the scroll bar will appear and on press Up ,down (and/or Left ,Right) it will scroll.
I will suggest to check the data in the contaire or just try to add some more data or increate the extent of the child widgets contained in the container
One more thing if you are getting the extent of thw container widget by IWIDGET_GetExtent() Then just make sure whether it returns the proper value or not . I hope it is not returning the proper value in your case ...
Regards,
Lalit

Thanx Lalit.Now my scrollbar is working.Problem was in the hight of constraint container widget. But it is scrolling down very slowly when i press down key.I want to get the text widget on visible screen as soon as the text widget gets focus.But in this case text widget gets focus when i press down key but i have to press down key many times to bring it on screen area .Any Idea?

Thanx Lalit.Now my scrollbar is working.Problem was in the hight of constraint container widget. But it is scrolling down very slowly when i press down key.I want to get the text widget on visible screen as soon as the text widget gets focus.But in this case text widget gets focus when i press down key but i have to press down key many times to bring it on screen area .Any Idea?

Hello,
Actually it depends on the increment value of the viewport widget. Its default value is 1 pixel. You can change it any time by using the property PROP_INCREMENT on view port widget. You have to make your code accordingly by changing this value of PROP_INCREMENT of the viewport widget as per your requirement.
Regards,
Lalit :)

Hello,
Actually it depends on the increment value of the viewport widget. Its default value is 1 pixel. You can change it any time by using the property PROP_INCREMENT on view port widget. You have to make your code accordingly by changing this value of PROP_INCREMENT of the viewport widget as per your requirement.
Regards,
Lalit :)

Thank you very much Lalit.It is working. :)

Thank you very much Lalit.It is working. :)