Jump to content

Destroing unused widgets


DeusExMachina

Recommended Posts

I have a bunch of buttons on screen, and I need to draw another window with another controls set. In site documentation we have a gwinDefault() function to destroy widget, but it seems that this function not implemented yet.

If you do not longer need the widget, you simply pass it's handle to the gwinDefault() routine. All the allocated memory will be freed and the widget area will be cleared.

Link to comment
Share on other sites

This clearly is a documentation typo. It's supposed to be gwinDestroy(). Thanks for finding, it has been fixed!

However, if you need different sets of controls, the tab widget might be of your interest too. The /demos/modules/gwin/widgets demo shows how it can be used (along the very simple example on the tab widget documentation page).

~ Tectu

Link to comment
Share on other sites

I found that gwinDestroy() destroys only last created widget (GHANDLE parameter ignored).

Can you please show how to reproduce your problem? The source does clearly show how the passed handle is used:


void gwinDestroy(GHandle gh) {
// Remove from the window manager
#if GWIN_NEED_WINDOWMANAGER
_GWINwm->vmt->Delete(gh);
#endif

// Class destroy routine
if (gh->vmt->Destroy)
gh->vmt->Destroy(gh);

// Clean up the structure
if (gh->flags & GWIN_FLG_DYNAMIC)
gfxFree((void *)gh);

gh->flags = 0; // To be sure, to be sure
}

~ Tectu

Link to comment
Share on other sites

Sorry, it was my error. I destroyed widgets (and they destroyed on memory, but not on the screen), but and when I called gdispClear() which cleared only last widget area I thought that it is destructor problem. I need to reset output window by gdispUnsetClip() to all screen size and after that to clear it.

Link to comment
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
×
×
  • Create New...