Problem in implementing Scrolling with Customize Font Strip | developer.brewmp.com Problem in implementing Scrolling with Customize Font Strip | developer.brewmp.com

Developer

Problem in implementing Scrolling with Customize Font Strip

Forums:

Hello Guys,

i am using a customize font strip image in which i know the x,y position and width of each character so i use IDisplayBitBlt() function to display the character or string which i want to display on screen,

But now i have to show suppose a help page which contains text which is longer than the height of the screen, so i need to implement the scrolling

i am not able to think logic for the scrolling, i have made the code to do horizontal word wrapping like if a word is going beyond width of the rectangle provided to show the string then that word comes in the new line,

But now i am not able to think any logic for vertical scrolling to be implemented.

Please help.

Calculate the total lines of text (say x) - use width of chars in your font strip to do so (you might have one such array).
Calculate the number of lines a screen can accommodate (say y) - use height of the font (same for all chars..i guess).
length of scrollbar (l)=x/y
each scroll = l/(x-y)
something like this...

Calculate the total lines of text (say x) - use width of chars in your font strip to do so (you might have one such array).
Calculate the number of lines a screen can accommodate (say y) - use height of the font (same for all chars..i guess).
length of scrollbar (l)=x/y
each scroll = l/(x-y)
something like this...

Atul suppose i have this information like how many lines can be accomodated in the screen,
When i press the DOWN button, how can i update the screen, like how will the remaining text will come up and top most will disappear, that is my problem.

Atul suppose i have this information like how many lines can be accomodated in the screen,
When i press the DOWN button, how can i update the screen, like how will the remaining text will come up and top most will disappear, that is my problem.

This is how my code is ::
Setting the rectangle inside which the text has to drawn
pIStaticRect.x= BOLD_FONT_HEIGHT;
pIStaticRect.y= ORIGIN + ((Controller *)pApp)->Fontobject->Heading_Rect.dy + (GAP_BET_OBJECTS * BOLD_FONT_HEIGHT);
pIStaticRect.dx= ((Controller *)pApp)->ScreenWidth - (BOLD_FONT_HEIGHT);
pIStaticRect.dy= ((Controller *)pApp)->Screenheight - (((Controller *)pApp)->Fontobject->Heading_Rect.dy + ((Controller *)pApp)->Fontobject->LSK_SoftKey_Rect.dy);
Calling the draw function which take cares of horizontal wrapping
((Controller *)pApp)->Fontobject->DrawText("This Application is Being Made by Vinay Agrawal as a dummy application",pIStaticRect,FONT_THIN);
This the draw function ::
Fontstrip::DrawText(char *string,AEERect pIRect,uint16 enumval)
{
x2=pIRect.x;
x1=0;
j=0;
i=0;
k=0;
len=STRLEN(string);
buf[0].length=0;
// Code by vinay agrawal
int m=0;
int pIRect_x = pIRect.x;
int pIRect_y = pIRect.y;
temp_buf_len = 0;
Font_Str_Len = 0;
for(int i=0;i<=len;i++)
{
if((string[i] == ' ') || (i == len))
{
if(Font_Str_Len > pIRect.dx)
{
pIRect.y=pIRect.y+FONT_THIN_HEIGHT + GAP_BET_OBJECTS;
pIRect.x=pIRect_x;
Font_Str_Len = 0;
}
for(int k=0;k

This is how my code is ::
Setting the rectangle inside which the text has to drawn
pIStaticRect.x= BOLD_FONT_HEIGHT;
pIStaticRect.y= ORIGIN + ((Controller *)pApp)->Fontobject->Heading_Rect.dy + (GAP_BET_OBJECTS * BOLD_FONT_HEIGHT);
pIStaticRect.dx= ((Controller *)pApp)->ScreenWidth - (BOLD_FONT_HEIGHT);
pIStaticRect.dy= ((Controller *)pApp)->Screenheight - (((Controller *)pApp)->Fontobject->Heading_Rect.dy + ((Controller *)pApp)->Fontobject->LSK_SoftKey_Rect.dy);
Calling the draw function which take cares of horizontal wrapping
((Controller *)pApp)->Fontobject->DrawText("This Application is Being Made by Vinay Agrawal as a dummy application",pIStaticRect,FONT_THIN);
This the draw function ::
Fontstrip::DrawText(char *string,AEERect pIRect,uint16 enumval)
{
x2=pIRect.x;
x1=0;
j=0;
i=0;
k=0;
len=STRLEN(string);
buf[0].length=0;
// Code by vinay agrawal
int m=0;
int pIRect_x = pIRect.x;
int pIRect_y = pIRect.y;
temp_buf_len = 0;
Font_Str_Len = 0;
for(int i=0;i<=len;i++)
{
if((string[i] == ' ') || (i == len))
{
if(Font_Str_Len > pIRect.dx)
{
pIRect.y=pIRect.y+FONT_THIN_HEIGHT + GAP_BET_OBJECTS;
pIRect.x=pIRect_x;
Font_Str_Len = 0;
}
for(int k=0;k

vinay d agrawal wrote:Atul suppose i have this information like how many lines can be accomodated in the screen,
When i press the DOWN button, how can i update the screen, like how will the remaining text will come up and top most will disappear, that is my problem.
perhaps you have to redraw the screen on up/down key.

vinay d agrawal wrote:Atul suppose i have this information like how many lines can be accomodated in the screen,
When i press the DOWN button, how can i update the screen, like how will the remaining text will come up and top most will disappear, that is my problem.
perhaps you have to redraw the screen on up/down key.

I know i have to redraw the screen, but i will also have to change the content or the coordinates to display the data, but how will i know the coordinates or the content which has to be displayed!!!!

I know i have to redraw the screen, but i will also have to change the content or the coordinates to display the data, but how will i know the coordinates or the content which has to be displayed!!!!

You have to divide the content into lines and store it as a array. When you scroll down, remove first line and draw next line (after a page) in the buffer...
Need to refresh screen on each scroll.
Lets say you have 7 lines on a page...on scroll down..remove line 1 and draw from lines 2 to 8. need to keep the counter.

You have to divide the content into lines and store it as a array. When you scroll down, remove first line and draw next line (after a page) in the buffer...
Need to refresh screen on each scroll.
Lets say you have 7 lines on a page...on scroll down..remove line 1 and draw from lines 2 to 8. need to keep the counter.