Static Text Scrolling | developer.brewmp.com Static Text Scrolling | developer.brewmp.com

Developer

Static Text Scrolling

Forums:

I am using static widget to set my text. Please suggest something some ideas.

Is it problem wit my widget type for scrolling text????????

Here is my code snippet:

ISHELL_CreateInstance(pMe->piShell, AEECLSID_RootForm, (void **)&pMe->piRootForm);

 

 

ISHELL_CreateInstance(pMe->piShell, AEECLSID_Form,(void **)&pMe->piForm);

//IRootContainer_SetCanvas(pMe->proot, pMe->piCanvas, &(pMe->rcRoot));

 

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ListWidget, (void **)&(pMe->piwTitle));

 

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_StaticWidget, (void **)&(pMe->piw));

 

nErr =ISHELL_CreateInstance(pMe->piShell, AEECLSID_ScrollbarWidget , (void **)&pMe->pidScrollbar);

 

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ImageWidget, (void **)&(pMe->pbgimage));

 

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_ValueModel, (void **)&(pMe->pif));

 

   result= IRootContainer_QueryInterface(pMe->picRoot,AEEIID_IWidget,(void**)&pMe->piwRoot);

 

//if(IWidget_GetModel(pMe->piwTitle,AEEIID_IValueModel,(IModel**)&pMe->pif)==AEE_SUCCESS)

{

IValueModel_SetTextPtr(pMe->pif,awchTitle,len);

IValueModel_Release(pMe->pif);

}

 

nErr=IWidget_SetModel(pMe->piw,CAST(IModel*,pMe->pif));

 

   //IWIDGET_SetText(pMe->piwTitle,awchTitle,TRUE);

 

IWidget_SetFGColor(pMe->piw,MAKE_RGB(255,0,0));

 

IWidget_SetBGColor(pMe->piw,MAKE_RGB(255,255,0));

 

IWidget_SetFlags(pMe->piw,SWF_WRAPTEXT);

 

nErr=IWidget_SetProperty(pMe->piw,PROP_SCROLLTEXT,0);

IWidget_SetProperty(pMe->piw,FID_TITLE,0);

IWidget_SetBorderWidth( pMe->piw , 2 );

IWidget_SetBorderColor( pMe->piw , MAKE_RGB(255,0,255 ));

IWidget_GetPreferredExtent(pMe->piw,&we);

we.width=180;

we.height=150;

IWidget_SetExtent(pMe->piw,&we);

dwpos.x=0;

dwpos.y=0;

dwpos.bVisible=TRUE;

IRootContainer_Insert(pMe->proot,pMe->piw,WIDGET_ZNORMAL,&dwpos);

 

 

/////Scroll bar implementation*********************************************************************/////////////////

we.width=10;

we.height=110;

IRootContainer_QueryInterface(pMe->proot, AEEIID_IWidget, &pMe->piwXY);

IWIDGET_SetExtent(pMe->piwXY, &we); 

IDecorator_SetWidget((IDecorator*)(void*)pMe->pviewport, pMe->piwXY);

// adjust the scroll increment. default is 1 pixel.

result=IWIDGET_SetIncrement(pMe->pviewport, 2);

IWIDGET_SetExtent(pMe->pviewport, &we);

// wrap the scrollbar around the viewport

IDecorator_SetWidget(pMe->pidScrollbar, pMe->pviewport);

IWIDGET_SetFlags( IDecorator_to_IWidget(pMe->pidScrollbar),SBWF_NOAUTOHIDE|SBWF_ARROWS|SCROLL_VERT|SBWF_FOCUSTRACK);

IWidget_SetProperty(IDecorator_to_IWidget(pMe->pidScrollbar), PROP_SCROLLBARENDPAD, 5);

IWidget_SetProperty(IDecorator_to_IWidget(pMe->pidScrollbar),PROP_SCROLLPAD ,20);

IWidget_SetProperty(IDecorator_to_IWidget(pMe->pidScrollbar),PROP_VSCROLLFILLRECT ,0);

IWidget_SetScrollBorderWidth(IDecorator_to_IWidget(pMe->pidScrollbar), 1);

IWidget_SetScrollHandleWidth(IDecorator_to_IWidget(pMe->pidScrollbar), 5);

IWIDGET_SetExtent(IDecorator_to_IWidget(pMe->pidScrollbar), &we);

IWidget_SetScrollColor(IDecorator_to_IWidget(pMe->pidScrollbar), MAKE_RGB(255,0,0));

IWidget_SetScrollFillColor(IDecorator_to_IWidget(pMe->pidScrollbar), MAKE_RGB(0,0,0));

//IWidget_SetFlags(IDecorator_to_IWidget(pMe->pidScrollbar), 3);

IWIDGET_SetExtent(IDecorator_to_IWidget(pMe->pidScrollbar), &we);

IDecorator_SetWidget(pMe->pidScrollbar, pMe->piw);

 

// insert widget into root container

dwpos.x=10;

dwpos.y=0;

dwpos.bVisible = TRUE;

(void)IRootContainer_Insert(pMe->picRoot, IDecorator_to_IWidget(pMe->pidScrollbar), WIDGET_ZNORMAL,&dwpos);

///wrapping scroll bar to the list widget

IWidget_SetTargetWidget(IDecorator_to_IWidget(pMe->pidScrollbar), pMe->piw); 

 

 

if(result==AEE_SUCCESS)

{

nErr=IForm_SetWidget(pMe->piForm,WID_FORM,pMe->piwRoot);

 

nErr=IRootForm_PushForm(pMe->piRootForm,pMe->piForm);

}

Regards Srinag

Hi,
 
 
 

In order to scroll text in a static widget, you want to configure the scrolling info if the default settings do not satisfy your requirements.  You can do that by doing the following:
 
 

ScrollText scrollInfo; 
// Init scrolling struct (speed, # of times, etc.) ZEROAT(&scrollInfo);
 
 
// step size in pixels 
scrollInfo.nScrollAmount = 3;
 
 
// scroll speed (msec) 
scrollInfo.nScrollDelay = 100;
 
// delay before start (msec)
scrollInfo.nStartDelay = 100;
 
// delay before ending (msec)
scrollInfo.nEndDelay = 1000;
 
// number of times to repeat
scrollInfo.nRepeat = 2;
 
 
 
// Tell widget how the text should scroll
(
void) IWidget_SetProperty(piWidget, PROP_SCROLLTEXT, (uint32)&scrollInfo);
 
 

  
 
 
Once you are ready for the animation (i.e. the ticker effect) you call the following:
 
 
IWidget_SetProperty(pMe->piwStaticWidget, PROP_ANIMATE, TRUE);
 
 
 

 
 
I also noticed that you are wrapping the same scrollbar around two different widgets in your snippet.  You should make sure that you create a new instance of the scrollbar for each widget it decorates.
 
Good luck,
 
Jason 
 
 

Hi,
 
 
 

In order to scroll text in a static widget, you want to configure the scrolling info if the default settings do not satisfy your requirements.  You can do that by doing the following:
 
 

ScrollText scrollInfo; 
// Init scrolling struct (speed, # of times, etc.) ZEROAT(&scrollInfo);
 
 
// step size in pixels 
scrollInfo.nScrollAmount = 3;
 
 
// scroll speed (msec) 
scrollInfo.nScrollDelay = 100;
 
// delay before start (msec)
scrollInfo.nStartDelay = 100;
 
// delay before ending (msec)
scrollInfo.nEndDelay = 1000;
 
// number of times to repeat
scrollInfo.nRepeat = 2;
 
 
 
// Tell widget how the text should scroll
(
void) IWidget_SetProperty(piWidget, PROP_SCROLLTEXT, (uint32)&scrollInfo);
 
 

  
 
 
Once you are ready for the animation (i.e. the ticker effect) you call the following:
 
 
IWidget_SetProperty(pMe->piwStaticWidget, PROP_ANIMATE, TRUE);
 
 
 

 
 
I also noticed that you are wrapping the same scrollbar around two different widgets in your snippet.  You should make sure that you create a new instance of the scrollbar for each widget it decorates.
 
Good luck,
 
Jason