Jump to content
manoj

Help on even trigger action

Recommended Posts

Hi everyone, looking at uGFX wiki I have able to do some gui works already !..

I am little stuck now in the gListener part, I created a push button and do a action when it's triggered, where Change the page.. When I trigger the button the page changes but the screen is just pure white(blank)... To make sure it's correct on my page I tried calling out of the trigger action (Switch Statement for GEventGWinButton) it worked well.. I am not sure is it smtg related to stack memory limit or what, if yes how to go about it ? Pls give me some helping hand.. here I quote the portion of the code below. Cheers! Looking forward some response 

 

Quote

void guiEventLoop(void)
{
    GEvent* pe;

    while (1) {
        // Get an event
        pe = geventEventWait(&glistener, 100);
        switch (pe->type) {
            case GEVENT_GWIN_BUTTON:
                if (((GEventGWinButton*)pe)->gwin == touch_button_df_pg) {

                    
                    dejavu_sans_16 = gdispOpenFont("DejaVuSans16");
                    dejavu_sans_12 = gdispOpenFont("DejaVuSans12");
                    dejavu_sans_24 = gdispOpenFont("DejaVuSans24");
                    GWidgetInit wi;
                    gwinWidgetClearInit(&wi);
                    
                    createPagePage1();
                    guiShowPage(1);
                }
                break;
            default:
                break;
        }

    }
}

 

Share this post


Link to post
Share on other sites

If you are using a timeout value (eg 100) to geventEventWait rather than TIME_INFINITE then geventEventWait can return NULL indicating that there was a 100ms timeout.

Either change 100 to TIME_INFINITE or put in code to handle the NULL before the switch statement.

Share this post


Link to post
Share on other sites
7 hours ago, inmarket said:

If you are using a timeout value (eg 100) to geventEventWait rather than TIME_INFINITE then geventEventWait can return NULL indicating that there was a 100ms timeout.

Either change 100 to TIME_INFINITE or put in code to handle the NULL before the switch statement.

Even if I put TIME_INFINITE i HAVE THE ISSUE... i suspect I am out of stack memory because the function is called from an function 

Share this post


Link to post
Share on other sites

If you didn't find the problem until now there are three things you can easily do:

  1. Instead of changing the page, just printf() something. This way you don't run into another issue upon changing pages that might look like the button stuff is not working.
  2. Run the button demo that you can find under /demos/modules/gwin/button
  3. Quickly fire up the µGFX-Studio (that you can download from this website under Downloads). It allows you to create very simple GUI pages and it generates an event-loop for you. Add that code to your project and give it a try (you'll still have to call the guiShowPage() functions yourself to actually change the page though.

The issue mentioned by @inmarket is definitely something that is wrong here too so you might to keep that one in mind for the future.

An additional remark: It's usually very bad practice to load fonts upon switching display pages. Unless fonts are being loaded from an external memory source because they are not byte-addressable they don't take up a lot of space. It's merely a header with a bit of metadata. Therefore, fonts are usually kept open indefinitely for regular applications. But at the end this really depends on what you want to do.

Share this post


Link to post
Share on other sites

Hi All I have able to load the pages after #define GFX_OS_HEAP_SIZE       2000 but still my next page is a keyboard where it hangs.. 

Edited by Joel Bodenmann
Removing unnecessary quotes of complete previous post.

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×