manoj Posted July 27, 2017 Report Share Posted July 27, 2017 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; } } } Link to comment Share on other sites More sharing options...
inmarket Posted July 27, 2017 Report Share Posted July 27, 2017 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. Link to comment Share on other sites More sharing options...
manoj Posted July 28, 2017 Author Report Share Posted July 28, 2017 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 Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted July 28, 2017 Report Share Posted July 28, 2017 If you didn't find the problem until now there are three things you can easily do: 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. Run the button demo that you can find under /demos/modules/gwin/button 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. Link to comment Share on other sites More sharing options...
manoj Posted July 28, 2017 Author Report Share Posted July 28, 2017 (edited) 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 July 29, 2017 by Joel Bodenmann Removing unnecessary quotes of complete previous post. Link to comment Share on other sites More sharing options...
Hendry Posted April 4, 2018 Report Share Posted April 4, 2018 hey @manoj, have you init & attach the listener (glistener) before loop? geventListenerInit(&glistener); gwinAttachListener(&glistener); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now