Can I change color of IStatic text? | developer.brewmp.com Can I change color of IStatic text? | developer.brewmp.com

Developer

Can I change color of IStatic text?

Forums:

Can I change color of IStatic text? I want to get different colors for my static text.

On this reference I don't find answer on my question. This discussion about background colors. I want to have different colors of the text on my IStatic. May be this impossible?

On this reference I don't find answer on my question. This discussion about background colors. I want to have different colors of the text on my IStatic. May be this impossible?

This may require some work but it is certainly possible. You need to implement your IFONT extension. Use IDISPLAY_SetFont to set your font extension as the default font your control. In your IFONT_DrawText you can do color manipulation (this method will be called by BREW when you try to write text in your text control).
ruben

This may require some work but it is certainly possible. You need to implement your IFONT extension. Use IDISPLAY_SetFont to set your font extension as the default font your control. In your IFONT_DrawText you can do color manipulation (this method will be called by BREW when you try to write text in your text control).
ruben

Hey buddy,
Use IDISPLAY_SetColor( ((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,CLR_USER_TEXT,MAKE_RGB( 0,0, 255));
to Change the text color before redarwing your control.
Cheers
Pramod Kaushik

Hey buddy,
Use IDISPLAY_SetColor( ((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,CLR_USER_TEXT,MAKE_RGB( 0,0, 255));
to Change the text color before redarwing your control.
Cheers
Pramod Kaushik

pramod_kaushik, Thanks for your help, but this method is right for use only if one color on your IStatic object. I want to use many colors at once. May be it is possible if use IFont interface but I haven't any example. If you know how make it please tell me...

pramod_kaushik, Thanks for your help, but this method is right for use only if one color on your IStatic object. I want to use many colors at once. May be it is possible if use IFont interface but I haven't any example. If you know how make it please tell me...

As I have mentioned in my previous response, you can create IFONT extension.
1. Call ISHELL_CreateInstance for your IFONT extension.
2. Call IDISPLAY_SetFont and pass the new IFONT instance. Save the old IFONT handler returned by this method.
3. Now you can use IFONT_GetInfo to get font size information, and IFONT_Measure text would help you to determine the correct size of the string can be drawn in particular line.
4. Now, whenever you try to draw any text, default IDISPLAY interface would call your IFONT_DrawText where you can do necessay processing to set right color.
This method requires some work but it is possible to achieve.
ruben

As I have mentioned in my previous response, you can create IFONT extension.
1. Call ISHELL_CreateInstance for your IFONT extension.
2. Call IDISPLAY_SetFont and pass the new IFONT instance. Save the old IFONT handler returned by this method.
3. Now you can use IFONT_GetInfo to get font size information, and IFONT_Measure text would help you to determine the correct size of the string can be drawn in particular line.
4. Now, whenever you try to draw any text, default IDISPLAY interface would call your IFONT_DrawText where you can do necessay processing to set right color.
This method requires some work but it is possible to achieve.
ruben

You might be able to get close to your desired affect by putting the color changing code in a timer callback. Just reset the timer before you exit the callback so that it fires again to achieve the color shifting affect. You'd need a flag to track which color you used the last time and you'll have to check to make sure that the IStatic still exists each time you change the color.
Just a thought.

You might be able to get close to your desired affect by putting the color changing code in a timer callback. Just reset the timer before you exit the callback so that it fires again to achieve the color shifting affect. You'd need a flag to track which color you used the last time and you'll have to check to make sure that the IStatic still exists each time you change the color.
Just a thought.

Please tell me wheather you want to change the color of whole Text periodically. like
This is sample Text.
This is sample Text.
This is sample Text.
OR
You want to have different colors within the Text :-
This is sample Text.
This will help in understanding your requirement in depth.

Please tell me wheather you want to change the color of whole Text periodically. like
This is sample Text.
This is sample Text.
This is sample Text.
OR
You want to have different colors within the Text :-
This is sample Text.
This will help in understanding your requirement in depth.

I want to have different colors within the Text :
This is sample Text.
I appreciate for your help.

I want to have different colors within the Text :
This is sample Text.
I appreciate for your help.

You can do it with your own textcontrol function which internaly will be using DrawText function to draw individual Line OR words or character whatever is your requrement of different color and set the color of text before individual drawText.
This will give you the exact desire result you want:-
A sample code just a few line not the entire function:-
char *tempStr; // To store Pointer to Hello world char string
AECHAR *szBuf; // To store Pointer to Hello world AECHAR string
tempStr = (char *) MALLOC(sizeof(char)*12);
STRCPY(tempStr,"Hello Word");
//Assign memory to szBuf
szBuf = (AECHAR*) MALLOC(12*sizeof(AECHAR));
//Convert string from char to AECHAR
STR_TO_WSTR(tempStr,szBuf,12*sizeof(AECHAR));
IDISPLAY_SetColor( ((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,CLR_USER_TEXT,MAKE_RGB( 0,0, 255));
IDISPLAY_DrawText(((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,NULL,szBuf,-1,4,5,NULL,NULL);
IDISPLAY_SetColor( ((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,CLR_USER_TEXT,MAKE_RGB( 0,255, 255));
IDISPLAY_DrawText(((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,NULL,szBuf,-1,4,25,NULL,NULL);
IDISPLAY_Update(((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay);
return;
This will show the helloworld in two different colors.
Let me know if you are unable to implement it.

You can do it with your own textcontrol function which internaly will be using DrawText function to draw individual Line OR words or character whatever is your requrement of different color and set the color of text before individual drawText.
This will give you the exact desire result you want:-
A sample code just a few line not the entire function:-
char *tempStr; // To store Pointer to Hello world char string
AECHAR *szBuf; // To store Pointer to Hello world AECHAR string
tempStr = (char *) MALLOC(sizeof(char)*12);
STRCPY(tempStr,"Hello Word");
//Assign memory to szBuf
szBuf = (AECHAR*) MALLOC(12*sizeof(AECHAR));
//Convert string from char to AECHAR
STR_TO_WSTR(tempStr,szBuf,12*sizeof(AECHAR));
IDISPLAY_SetColor( ((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,CLR_USER_TEXT,MAKE_RGB( 0,0, 255));
IDISPLAY_DrawText(((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,NULL,szBuf,-1,4,5,NULL,NULL);
IDISPLAY_SetColor( ((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,CLR_USER_TEXT,MAKE_RGB( 0,255, 255));
IDISPLAY_DrawText(((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay,NULL,szBuf,-1,4,25,NULL,NULL);
IDISPLAY_Update(((AEEApplet *) GETAPPINSTANCE())->m_pIDisplay);
return;
This will show the helloworld in two different colors.
Let me know if you are unable to implement it.

Hi Buddy,
I needed to create the control to put background image and columns like table in Istatic, so I created my own text control.
Let me know if you are still unable to put different color text onto it.

Hi Buddy,
I needed to create the control to put background image and columns like table in Istatic, so I created my own text control.
Let me know if you are still unable to put different color text onto it.

Thanks Promod.
Now I am able to have text of different colors.
Regds,
Sandy..

Thanks Promod.
Now I am able to have text of different colors.
Regds,
Sandy..