Jump to content
Hamidrm

GLISTENER_WITHLISTENER flag in gevent

Recommended Posts

I have two frames widget in my project and created a customize widget for Horizontal Menu. I need to destroy previous frame at switching between them and create the new second frame in each toggle event. when I call gwinDestroy for first frame, I will miss events of "Horizontal Menu" in second frame. I traced uGFX functions and realize that by calling gwinDestroy, uGFX will call doExitEvent from the deleteAssignments and set "flags" field of widget GListener to GLISTENER_WITHLISTENER. Then when new Frame created and toggle button attached to its child (Horizontal Menu), my program will miss widget events because of GLISTENER_WITHLISTENER flag. For ensuring about it, I commented line 34 of https://git.ugfx.io/uGFX/uGFX/src/master/src/gevent/gevent.c  temporary and then second frame toggle event works well as first one.

My question is how can i reset GListener->flags of widgets to zero (or flags&=~GLISTENER_WITHLISTENER), after calling gwinDestroy?

Edited by Hamidrm

Share this post


Link to post
Share on other sites

I'll have to look at this when I got a bit more time to understand this properly. However, unless you're in a serious memory shortage I'd recommend you not to destroy & re-create the widgets. Instead, just use gwinShow() and gwinHide() (alternatively gwinSetVisible()) to make the appropriate widget become visible.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×