Static Widget doesn't scroll for WIDGET_SIZE_TO_FIT | developer.brewmp.com Static Widget doesn't scroll for WIDGET_SIZE_TO_FIT | developer.brewmp.com

Developer

Static Widget doesn't scroll for WIDGET_SIZE_TO_FIT

Hi All,

I am trying to enable scrolling in static widget and what i found is,

Static widget is not scrolling when the right constraint of the static widget is set as WIDGET_SIZE_TO_FIT.

But the same works if the right constraint is CONSTRAINT_PARENT_RIGHT.

Please let me know when WIDGET_SIZE_TO_FIT should be used and what is the concept behind WIDGET_SIZE_TO_FIT?

I have attached my code.

boolean PhoneBook_TempAlert(firstproject *pMe,uint16 strid)
{
int ret_val;

IWidget *pxyquery;

IConstraintContainer *pContainer = NULL;

AECHAR Title[10] = { 'T', 'r','y'};

WidgetConstraint wc = {0};

ScrollText stProps = {0};

WExtent we;

// Create Form
ret_val = ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_POPUPFORM,
&pMe->pTempAlertForm);

if(ret_val != SUCCESS)
{
return FALSE;
}

HANDLERDESC_Init(&pMe->m_popupformHandler, PhoneBook_Popup_FormHandleEvent,
pMe, NULL);

IFORM_SetHandler((IForm*)pMe->pTempAlertForm, &pMe->m_popupformHandler);

IFORM_SetTitle((IForm*)pMe->pTempAlertForm,Title);

// IFORM_SetResBGImage(pMe->pTempAlertForm,FIRSTPROJECT_RES_FILE,IDI_BG);
// Create COntainer
ret_val = ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_CONSTRAINTCONTAINER,
&pContainer);

if(ret_val != SUCCESS)
{
return FALSE;
}

ret_val = ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_STATICWIDGET,
&pMe->pStaticWidget);
if(ret_val != SUCCESS)
{
return FALSE;
}

pMe->popup_string = (AECHAR*)MALLOC(200);

ISHELL_LoadResString(pMe->a.m_pIShell,FIRSTPROJECT_RES_FILE,
strid,pMe->popup_string,200);

stProps.nScrollAmount = 1;
stProps.nScrollDelay = 1000;
stProps.nStartDelay = 125;
stProps.nEndDelay = 500;
stProps.nRepeat = 3;

ret_val = IWIDGET_SetText(pMe->pStaticWidget,pMe->popup_string,TRUE);
// Set the properties, No Shorten text
IWIDGET_SetFlags(pMe->pStaticWidget, IDF_ALIGN_LEFT | SWF_NOSHORTENTEXT);
IWIDGET_SetProperty(pMe->pStaticWidget, PROP_FONT_CLASS,
AEECLSID_FONTSYSNORMAL);

IWIDGET_SetProperty( pMe->pStaticWidget, PROP_FGCOLOR, RGB_BLACK);

// Scroll effect
ret_val = IWIDGET_SetProperty( pMe->pStaticWidget,
PROP_SCROLLTEXT,
(uint32) &stProps );

ret_val = IWIDGET_SetProperty(pMe->pStaticWidget,
PROP_ANIMATE,
TRUE);

// Set the constarints
wc.constraint.left.type = CONSTRAINT_PARENT_LEFT;
wc.constraint.left.offset = 2;
wc.constraint.right.type = WIDGET_SIZE_TO_FIT;
wc.constraint.top.type = CONSTRAINT_PARENT_TOP;
wc.constraint.top.offset = 0;
wc.constraint.bottom.type = CONSTRAINT_PARENT_TOP;
wc.constraint.bottom.offset = 27;
wc.bVisible = TRUE;

ICONSTRAINTCONTAINER_Insert(pContainer,pMe->pStaticWidget,WIDGET_ZNORMAL,&wc);

ICONSTRAINTCONTAINER_QueryInterface(pContainer,AEEIID_WIDGET,(void **)&pxyquery);

IFORM_SetWidget((IForm*)pMe->pTempAlertForm,WID_FORM,pxyquery);

RELEASEIF(pxyquery);

IROOTFORM_PushForm(pMe->pRootForm,(IForm*)pMe->pTempAlertForm);

IFORM_Activate((IForm*)pMe->pTempAlertForm);

return TRUE;

}

A static widget only needs to marquee scroll if the text doesn't fit inside the widget. When you use WIDGET_SIZE_TO_FIT as the right constraint, the constraint container makes the static widget wide enough to fit the text. So it doesn't need to scroll.
-Erik

A static widget only needs to marquee scroll if the text doesn't fit inside the widget. When you use WIDGET_SIZE_TO_FIT as the right constraint, the constraint container makes the static widget wide enough to fit the text. So it doesn't need to scroll.
-Erik