eGUI: which objects to display live data ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

eGUI: which objects to display live data ?

2,983 Views
robroz
Contributor III

Hi,

I'm designing eGUI interface and I'd like to display live temperatures over single color background.

I've tried with Label graphical object, but it seems to have a bug and all values are overwritten instead of only last value.

I see that Sliders and Buttons are doing this properly, but have difficulty to make button invisible (to be visually the same as label)...

Any experience, example code or advice on this simple problem ?

Thanks in advance,

regards,

Bulek.

Tags (2)
0 Kudos
19 Replies

2,043 Views
NacuriErick
Contributor I

hello Petr

I found D4D_FNT_PRTY_TRANSPARENT_YES _MASK defined on the d4d_user_config.h  but i changed and nothing  happened.


On the Scrn_onInit routine I have this:

tmpString.fontId = FONT_ARIALNARROW;

  tmpString.printLen = 10;

  tmpString_prty.font_properties.all = D4D_FNT_PRTY_TRANSPARENT_NO_MASK;

  tmpString_prty.text_properties.all = D4D_TXT_PRTY_ALIGN_H_RIGHT_MASK;

  tmpString.str_properties = &tmpString_prty;

so i think this is the same  that you're suggesting.


Now  for my app I'm using a button to change the live data and its working, but the font changes to another one I have not selected, how do I change that ?

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

Hi,

could you share here the source code of screen and user config, maybe just cut version with isolated problem?

I will look at it - maybe this will be useful for other people on community.

Petr

0 Kudos

2,043 Views
NacuriErick
Contributor I

this is source code  isolated and i think the user config  file is not necessary  because  I do the string properties changes  on the OnInit routine , hope this helps no only to me !

D4D_CHAR str_cms[5] = {0};

D4D_STRING tmpString;

D4D_STR_PROPERTIES tmpString_prty;

D4D_DECLARE_TXT_RBUTTON(scrRadio_btnstation, str_cms,50, 50, 0, 0, 12, FONT_ARIALNARROW; NULL)

uint8_t StaBRadiobtnflag ;

static void ScreenRadio_OnInit()

{

  tmpString.fontId = FONT_ARIALNARROW;

  tmpString.printLen = 10;

  tmpString_prty.font_properties.all = D4D_FNT_PRTY_TRANSPARENT_NO_MASK;

  tmpString_prty.text_properties.all = D4D_TXT_PRTY_ALIGN_H_RIGHT_MASK;

  tmpString.str_properties = &tmpString_prty;

}

static void ScrRadio_OnClickBtnback(D4D_OBJECT* pThis)

{

  StaBRadiobtnflag = 1;

}

static void ScreenMain_OnMain()

{

  if (StaBRadiobtnflag == 1)

  {

  StaBRadiobtnflag = 0;

  RadioStation = radio_get_frequency();// get radio Frecuency

  u16toascii(RadioStation, &str_cms[0]); // convert to ascii

  D4D_BtnSetText(&scrRadio_btnstation,&str_cms[0]); //display data

  }

}

and my problem is , that the font after the redraw is changed !

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

Hello,

I found the issue  :-).

The problem is that you are using instead of the D4D_CHAR[] variable, complete internal D4D_STRING type, what is not targeted as a input parameter.

This is example of runtime changing, for preprocessor version change the D4D_BTN_FNT_PRTY_DEFAULT to your options in user config.

Just rewrite the code into this version:

D4D_CHAR str_cms[5] = {0};

D4D_DECLARE_TXT_RBUTTON(scrRadio_btnstation, str_cms,50, 50, 0, 0, 12, FONT_ARIALNARROW; NULL)

uint8_t StaBRadiobtnflag ;

static void ScreenRadio_OnInit()

{

D4D_SetFontProperties( &scrRadio_btnstation, D4D_FNT_PRTY_TRANSPARENT_NO_MASK);

D4D_SetTextProperties( &scrRadio_btnstation, D4D_TXT_PRTY_ALIGN_H_RIGHT_MASK);

}

static void ScrRadio_OnClickBtnback(D4D_OBJECT* pThis)

{

  StaBRadiobtnflag = 1;

}

static void ScreenMain_OnMain()

{

  if (StaBRadiobtnflag == 1)

  {

  StaBRadiobtnflag = 0;

  RadioStation = radio_get_frequency();// get radio Frecuency

// there is two option how to do this

#if 0

u16toascii(RadioStation, &str_cms[0]); // convert to ascii

// Just invalidate object because you are already change the text in memory

D4D_InvalidateObject(&scrRadio_btnstation, D4D_FALSE);

#else

{

// prepare the text in temporary array and then call SetTxt function what itself copy the new string into object char array

D4D_CHAR tmp_char[5];

u16toascii(RadioStation, &tmp_char[0]); // convert to ascii

D4D_SetText(&scrRadio_btnstation,&tmp_char[0]); //display data

}

#endif

  }

}

Petr

0 Kudos

2,043 Views
NacuriErick
Contributor I

Hello Petr


I have to fix some issues with on onInit routine  with the next code


static void ScreenRadio_OnInit()

{

     tmpString.fontId = FONT_ARIALNARROW;

      tmpString.printLen = 10;

      tmpString_prty.font_properties.all = D4D_FNT_PRTY_TRANSPARENT_NO_MASK;

      tmpString_prty.text_properties.all = D4D_TXT_PRTY_ALIGN_H_RIGHT_MASK;

     D4D_SetFontProperties( &scrRadio_btnstation, tmpString_prty.font_properties);

      D4D_SetTextProperties( &scrRadio_btnstation, tmpString_prty.text_properties);

}


otherwise  an error occurs  for illegal conversion

now  the text in the button is working almost fine , but the font  is not the one  that I want to use, any ideas ?

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

Hello,

for the first thing - which version of eGUI you are using? It seems that any pretty old, because the code that you are writing here is using bit fields that was removed from eGUI a long time back.

I recommend switch to eGUI 3.0 beta -  Re: Sample code request eGui + TWR-K70 + TWR-LCD-RGB + MQX + CW

And next thing - please don't use tmpString variable for changing anything in the eGUI objects - this is internal structure that is not targeted to be as external API.

For changing text and font properties use the dedicated function as you have, and I show the usage in example, and if you want to change the font:

1: For on time change it directly in object declaration

2. For runtime - dedicate one font for string like you have in this object and change whole font table like is showed in example in Re: Sample code request eGui + TWR-K70 + TWR-LCD-RGB + MQX + CW.

Petr

0 Kudos

2,043 Views
NacuriErick
Contributor I

Hello

the version that I'm using is the v2.07 that is the one that I found on freescale web page , or at least is the number of the define  " # define D4D_VERSION "V2.07" ". in the D4D_base.h

The variable tmpString I used because I founded on a example demo code but i will renamed right away ! :smileyhappy: 

Now I will make the changes

thanks a lot for your help ! :smileyhappy:

0 Kudos

2,043 Views
NacuriErick
Contributor I

Hello Petr

In the Link there is only the EGui Converter , but the D4D lib it isn't , and the PDF files are corrupted  would you post again the version 3.0 of D4D

thanks

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

As I mentioned in previous thread - the PDF files a renamed ZIP files :-) due to firewalls.

Petr

0 Kudos

2,043 Views
elisamejia
Contributor III

Hello Petr,

I'm trying to run-time change the text in an object, it could be a lael or a button. Whenever I call the D4D_SetText function the system crashes. Can you tell me exactly how should I configure the variables and the function?

Elisa

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

HI,

The system crashes because the text of the label or button is stored by default in flash ☺.

So, use this construction of text definition for objects who should change the text in runtime:

static D4D_TCHAR my_text[] = "Maximal size of text!!!!";

D4D_DECLARE_STD_LABEL(my_label, my_text, 0, 0, 100, 20, FONT_BERLIN_SANS_FBDEMI12)

That’s all

Petr

2,043 Views
Gargy
NXP Employee
NXP Employee

Hello,

label is fine for this task, you have just issue that you have switch on transparency of text for this object, just switch transparency off and the label start works.

Also interesting object could be gauge for graphical appearance.

Best regards

Petr

0 Kudos

2,043 Views
robroz
Contributor III

Hi,

thanks for reponse. I'd be really happy if you're right...

I'm searching docs for Label and I can't see what to do to switch transparency of text to off - is this setting for label or only text ? Do you have quick hint, what to do to switch transparency off ?

Wait, I think I already tried this and it gives different background color for text - am I right? It looks quite ancient and not good... But maybe I can set this background to be the same as for the rest of the screen ?

I also tried with D4D_DrawTextTabXY and D4D_Draw_text_Rect_Tab_AdvXY - but they both display random horizontal lines over text. It seems like something (bug?) is overwritting StrikeThrough parameter and then lines are added over text - this also doesn't look right..

I've commented out the code for strikethrough and horizontal lines are gone. But still text is overwritten properly most of the time, but quite often it goes "mad" - overwritting is not proper (it seems like all write operations accumulate on screen)...

I'm also curious why button is working ok - live data on customizeable background. If button can do it, why is label failing to do this. In my understanding Label is just non-touch-enabled generic form ob button... If I used button, then the problem is how to make it non distringuishable from background ( to be the same color as background and also without borders)...

Thanks in advance,

regards,

Bulek.

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

Hello,

Transparency is standard property of TEXT:

#define D4D_FNT_PRTY_TRANSPARENT_NO_MASK (0x00)

#define D4D_FNT_PRTY_TRANSPARENT_YES_MASK (0x10)

void D4D_SetFontProperties(D4D_OBJECT_PTR pObject, D4D_FONT_PROPERTIES property)

Petr

0 Kudos

2,043 Views
robroz
Contributor III

It seems that it works better with proposed changes.

But I still see that occasionally this problem occurs, but most of the time it works ok.

Any clue why it doesn't work all the time ?

Thanks in advance,

regards,

Bulek.

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

Hi,

this is little bit hard to help you - so few information.
Could you place here your screen file? If it's not top secret? :-)

Petr

0 Kudos

2,043 Views
NacuriErick
Contributor I

Hello Petr

I  think I have the same issue,  when I'm trying to display data with labels it overwrite the label but does not  "erase" the old info, so the "shadow " of the old label is overwritten creating a mess , I also tried to modify the Transparency , using the D4D_FNT_PRTY_TRANSPARENT_NO_MASK property, but the info is not displayed at all, do you have any idea on how to solve it?

0 Kudos

2,043 Views
Gargy
NXP Employee
NXP Employee

Hello,

if the text is still overwrite the original one, the object has still SWITCH ON the transparency drawing or the second option is that you have (since version 3.0) SWITCH ON transparent color (option D4D_COLOR_TRANSPARENT) and this color you have same as color of text background.

I think that you failed in first option - please double check the real used FLAGS for the object that overwrite the text.

Or for test try in runtime (for example OnActivate function in the screen) sets the font properties of the label by function: void D4D_SetFontProperties( pObject, D4D_FNT_PRTY_TRANSPARENT_NO_MASK);

Petr

0 Kudos

2,043 Views
robroz
Contributor III

Hi,

thanks for responses. I still don't get it clearly.

If I switch transparency off, will I be able to draw label's text that will have same background color as the rest of picture ?

What confuses me, is if I think logically, I should use transparency, to be able to overlay text on background. Also don't get it why button works and label doesn't....

Thanks in advance for your responses,

regards,

Bulek.

0 Kudos