Problem in setting a long string text on multi line text

I have a window with several prompts, whose values i change by calling a custom made keyboard screen.

After editing the values, i check each of those for their respective ranges, and if found not in the ranges, prepare a string (by string catenating) to be set later on on a multi line view  in a modally executed window( an error window).  The resultant string is quite long but in the size of  multi line text view.

I observe  various strange behaviors when i try to set the string on the multi view.

observation 1) In some cases only a small part of the string is printed, the rest of the space in the multi line view remains blank.

observation 2) while in some attempts a small part of the string is printed repeatedly till the end of the view.

observation 3) a small part of  string is printed repeadtedly in one half of the the view and again the other  small part of the it is printed repeatedly on the other half.

 

** i have tried making the multi line text view as private copy, and passing the required allocate and deallocator functions for dynamic memory but the repeated printing of small part remains same.

** i also tried increasing the display list memory as suggested in one of the threads but even that did not solve the problem.

** i can even send the code( as to how i am catenating a  error message string on a global array, calling a modal window etc)

** also i have checked the catenated message string by using printf function and it has been made as required. line by line perfectly. 

please help

  • Today morning i also tried tp set the string text on a multi line input widget, and the same problem persists
  • In reply to heman:

    Good day, heman!

    How are things going so far? I hope you could wait for others who have idea on this issue. But, if you can't get an answer from this forum, feel free to submit a ticket to Renesas Technical Support.

    Best Regards,

    Sai
    RenesasRulz Forum Moderator
    https://renesasrulz.com/
    https://academy.renesas.com/
    en-us.knowledgebase.renesas.com/

  • In reply to Sai:

    Dear sai,
    it seems like the string text is set properly on the first attempt(1st instance of setting a text). But when i again clear the global char buffer(meant for holding catenated string text) and try to set the text, the text (maybe the previous) is repeated all over the multi line view.
  • In reply to heman:

    Hi heman,

    Do you use the same buffer to display text in other places too? gx_prompt_text_set (or equivalent, for other widgets) attaches specific buffer to the widget so every time the widget needs to be redrawn, it will use contents of the buffer to get the text to display.

    Regards
  • No karol,
    I am using this buffer for this specific multi line text widget only. Following is the idea of my code
    char error_string[500]; //declared globally

    bool check_validity()
    {

    int testing_count,value;
    testing_count=0;
    value=0;
    GX_PROMPT *prompt;
    GX_CHAR *read; //for collecting the prompt text
    char local[500]; //declared locally,for string catenation

    prompt=&fluidic_settings1.fluidic_settings1_prime_steps_field;
    gx_prompt_text_get(prompt,&read);
    value=atoi(read);
    //printf("ps:%d\n",value);

    if(value>=100 && value<=5000)
    {
    testing_count++;
    }
    else
    {
    strcat(local,"prime steps 100-5000 error\r");
    }
    .
    .
    .

    //16 such prompt text get and validation check
    .
    .
    .

    if(testing_count==16)
    {
    return 0;
    }
    else
    {
    strcpy(error_string,local); //copy local string into global string
    return 1;
    }

    }

    //error window called from here
    UINT fluidic_settings1_handler(GX_WINDOW* widget, GX_EVENT* event_ptr)
    {
    bool result=0;
    GX_MULTI_LINE_TEXT_INPUT *text_input; //changed now to multi line text input from multi line text view
    text_input=&error_popup.error_popup_text_input;

    switch (event_ptr->gx_event_type)
    {
    .
    .

    case GX_SIGNAL(ID_SAVE1, GX_EVENT_CLICKED):
    result=check_validity();
    gx_multi_line_text_input_set(text_input,error_string);
    gx_widget_detach(&fluidic_settings1);
    gx_widget_attach(root,&error_popup);
    break;
    .
    .

    default:
    return gx_window_event_process(widget, event_ptr);
    }
    return 0;
    }

    //error window handler function


    UINT error_popup_handler(GX_WINDOW* widget, GX_EVENT* event_ptr)
    {
    GX_MULTI_LINE_TEXT_INPUT *text_input;
    text_input=&error_popup.error_popup_text_input;

    switch (event_ptr->gx_event_type)
    {
    case GX_EVENT_SHOW:
    return gx_window_event_process(widget, event_ptr);

    case GX_SIGNAL(ID_CLOSE_ERROR_POPUP, GX_EVENT_CLICKED):


    gx_multi_line_text_input_buffer_clear(text_input);
    gx_widget_detach(&error_popup);
    gx_widget_attach(root,&fluidic_settings1);
    break;

    default:
    return gx_window_event_process(widget, event_ptr);
    }
    return 0;
    }

    What happens is when my range validation fails and i click the save1 button on fluidic_settings1 screen it switches to he popup error screen and populates the error string perfectly(full) on the multi line text input. But when i come back to the settings window again change the window and repeat the process, some part of the the previous string is set repeatedly theron.
    Is it something related to the char array being overflowed or what is it??
  • In reply to heman:

    Can anyone please help me??
  • In reply to heman:

    Hello heman,

    I'm having trouble reproducing this in my own project. Do you have a minimal application on one of kits that exhibits this problem?

    One thing I observed is that char local[500] in check_validity() is not zero-ed out before calling strcat(). Contents of this buffer are undefined until they're explicitly set. If I were to make an assumption that stack area this deep is not used elsewhere, it's likely that local[500] will contain the text from previous check_validity() invocation. strcat() will look for the first 0-byte to find the end of the buffer before appending its text - hence you would observe multiple copies in local, and then in error_string. Setting local[0] = 0; at the beginning of check_validity() should resolve this problem.

    Regards

  • In reply to Renesas Karol:

    I would check the mentioned solution out sir.
    Thankyou.
    Regards,
    Himanshu M