GUIX Hello World Demo Application can't go to the second Window

Hello Renesas Community,

i have a problem with the GUIX Hello World sample application.

The application compiles and starts as expected, also the functionalities from page one does work, but when i click onto the button Goto to next page

i got to the Default_Handler(). I don't where the problem lies. Does somebody had the same issue or does somebody maybe know where my fault is?

 

Thank you in advance and have a nice weekend.

 

Best regards,

 

Markus

  • Please try replacing the file src\guiapp_event_handlers.c with the version of that file from the S7G2-SK/S5D9-PK version of the GUIX Hello World application :-

    guiapp_event_handlers.txt
    
    #include "gui/guiapp_resources.h"
    #include "gui/guiapp_specifications.h"
    
    #include "main_thread.h"
    
    static bool button_enabled = false;
    
    extern GX_WINDOW_ROOT * p_window_root;
    
    static UINT show_window(GX_WINDOW * p_new, GX_WIDGET * p_widget, bool detach_old);
    static void update_prompt_text_id(GX_WIDGET * p_widget, GX_RESOURCE_ID id, UINT string_id);
    static void update_button_text_id(GX_WIDGET * p_widget, GX_RESOURCE_ID id, UINT string_id);
    
    UINT window1_handler(GX_WINDOW *widget, GX_EVENT *event_ptr)
    {
        UINT result = gx_window_event_process(widget, event_ptr);
    
        switch (event_ptr->gx_event_type)
        {
        case GX_SIGNAL(ID_BUTTONENABLER, GX_EVENT_TOGGLE_ON):
            button_enabled = true;
            update_button_text_id(widget->gx_widget_parent, ID_WINDOWCHANGER, GX_STRING_ID_BUTTON_ENABLED);
            update_prompt_text_id(widget->gx_widget_parent, ID_INSTRUCTIONS, GX_STRING_ID_INSTRUCT_BUTTON);
            break;
        case GX_SIGNAL(ID_BUTTONENABLER, GX_EVENT_TOGGLE_OFF):
            button_enabled = false;
            update_button_text_id(widget->gx_widget_parent, ID_WINDOWCHANGER, GX_STRING_ID_BUTTON_DISABLED);
            update_prompt_text_id(widget->gx_widget_parent, ID_INSTRUCTIONS, GX_STRING_ID_INSTRUCT_CHECKBOX);
            break;
        case GX_SIGNAL(ID_WINDOWCHANGER, GX_EVENT_CLICKED):
            if(button_enabled){
                show_window((GX_WINDOW*)&window2, (GX_WIDGET*)widget, true);
            }
            break;
        default:
            gx_window_event_process(widget, event_ptr);
            break;
        }
    
        return result;
    }
    
    UINT window2_handler(GX_WINDOW *widget, GX_EVENT *event_ptr)
    {
        UINT result = gx_window_event_process(widget, event_ptr);
    
        switch (event_ptr->gx_event_type){
            case GX_EVENT_PEN_UP:
                show_window((GX_WINDOW*)&window1, (GX_WIDGET*)widget, true);
                break;
            default:
                result = gx_window_event_process(widget, event_ptr);
                break;
        }
        return result;
    }
    
    static UINT show_window(GX_WINDOW * p_new, GX_WIDGET * p_widget, bool detach_old)
    {
        UINT err = GX_SUCCESS;
    
        if (!p_new->gx_widget_parent)
        {
            err = gx_widget_attach(p_window_root, p_new);
        }
        else
        {
            err = gx_widget_show(p_new);
        }
    
        gx_system_focus_claim(p_new);
    
        GX_WIDGET * p_old = p_widget;
        if (p_old && detach_old)
        {
            if (p_old != (GX_WIDGET*)p_new)
            {
                gx_widget_detach(p_old);
            }
        }
    
        return err;
    }
    
    static void update_prompt_text_id(GX_WIDGET * p_widget, GX_RESOURCE_ID id, UINT string_id)
    {
        GX_PROMPT * p_prompt = NULL;
    
        ssp_err_t err = (ssp_err_t)gx_widget_find(p_widget, (USHORT)id, GX_SEARCH_DEPTH_INFINITE, (GX_WIDGET**)&p_prompt);
        if (TX_SUCCESS == err)
        {
            gx_prompt_text_id_set(p_prompt, string_id);
        }
    }
    
    static void update_button_text_id(GX_WIDGET * p_widget, GX_RESOURCE_ID id, UINT string_id)
    {
        GX_TEXT_BUTTON * p_button = NULL;
    
        ssp_err_t err = (ssp_err_t)gx_widget_find(p_widget, (USHORT)id, GX_SEARCH_DEPTH_INFINITE, (GX_WIDGET**)&p_button);
        if (TX_SUCCESS == err)
        {
            gx_text_button_text_id_set(p_button, string_id);
        }
    }
    

  • In reply to Jeremy:

    Hey Jeremy,

    thank you very much, your answer solved my problem.

    Best regards,

    Markus
  • In reply to Jeremy:

    I have the same problem. the S5D9-PK version does not solve my issue. It looks like when I toggle the Press me checkbox to ON the button_enabled flag is not set to true. I set a break point at point where the button_enabled is st to true and it never trigger.
    Thanks,
    Nino
  • In reply to nino:

    Hi Nino-
    Can you tell us what board you are targeting and what versions of SSP and e2 studio you are using?

    Thanx!