How to delete window when navigating to other window to free up the memory.

i'm working on segger application, where i have 25-30 screen(windows) in my application. as i have more screens, memory conception is also more on Flash and RAM. so i have found the
WM_DeleteWindow(pMsg->hWin); function to delete window before navigating to other screen. but as i move on and update parameters values on run time, i have used child windows as pop-up and keypad-numeric screens.

WM_DeleteWindow() is THE function for deleting windows. I recommend to have only those windows created which are really required, (e.g. those which are visible and those having data which shouldn't get lost).

as i mentioned in above post, in my application, have 20+ screens(with child windows). currently as i said in above post, while navigating from 1st screen to 2nd screen, i'm using WM_DeleteWindow() function to delete 1st screen and creating 2nd scree. as well as while navigating back to 1st screen, using WM_DeleteWindow() function deleting 2nd screen and creating first screen. is this correct way to handle screens or any other method is available? please let me know.

and i also i want to know as i'm using segger emwin with micrichip harmony configurator, while configuring third party libraries there is an option to assign Memory block size. in example projects it is set to 224KB , as in my application i have set it to 160 due to RAM space. is this causing the hiding of widhgets??

and for my application we are using Microchip controller(PIC32MZ2025DAG176). i.e. having 256KB of RAM and 2048KB of Flash and 32MB of internal DDR. is this controller is suitable for segger emwin based applications or i need to have any other controllers??

the approach you have described is good. Although, there is no correct way.

Setting a memory block size is no longer required. It is sufficient to allocate memory for emWin (GUI_ALLOC_AssignMemory()). It might happen that at one point you do not have enough memory left to create another widget. Of course, this depends on the widget type and what you do with it. A LISTVIEW widget with a lot entries requires quite some memory (storing the strings and some control information).

As i said internal RAM is 256KB which is being used for normal application and for Frame buffer as well. i could not see any option to configure internal DDR for Framebuffer in Microchip Harmony Configurator. and ihave doubt on internal RAM, because as i see in MPLAB IDE RAM is occupied almost 80%. so i felt that RAM doesn't have enough space to create images on long run.

as i received response from Microchip, they said that atleast 512KB or 640 KB RAM is required to run these kind of applications(Segger emwin based).

Even i'm also facing the same issue of screen hiding when continuous switching happens between multiple screens in stm32 platform .
case1 : screen hiding issue occuring after 40 screens with the size (#define GUI_NUMBYTES (90 * 1024) ).
case 2:If i increase the GUI_NUMBYTES to 95*1024 the screen hiding is still occuring but this time after 45 screens.

As RAM size is constraint in my design i cant increase more than above.
so is there any procedure to delete the screens to overcome the buffer overflow and screen hiding issue.

Even i'm also facing the same issue of screen hiding when continuous switching happens between multiple screens in stm32 platform .
case1 : screen hiding issue occuring after 40 screens with the size (#define GUI_NUMBYTES (90 * 1024) ).
case 2:If i increase the GUI_NUMBYTES to 95*1024 the screen hiding is still occuring but this time after 45 screens.

As RAM size is constraint in my design i cant increase more than above.
so is there any procedure to delete the screens to overcome the buffer overflow and screen hiding issue.

Any help will be really appreciated.
Thanks in advance !

Regards,
sravan.

Hi,

I don't know if this helps or not, but figured I would at least describe they way I'm doing it, in case it can help you. I have about 10 or so different screens I've created (each that has various buttons, edit boxes, etc on each screen)..

During runtime of my board, I never have more than TWO screens (or we can call them windows or dialogs) actually active.. I have my 'main window' that is the first window that comes up, with a bunch of buttons and things that can then take you to sub-windows, etc..

Whenever I launch a sub-screen, I call the create() function for that screen/dialog and all it's components, just like how Segger shows you on here in their examples...if another menu is brought up from there, I first do a 'GUI_EndDialog()' on the current window/screen, in order to free/release it's windows/child windows/widgets, etc.. then call the create() function for the new screen.

So to simplify, my main_menu is always running, I don't delete or 'end dialog' that menu, but any sub-menus from there, I always do a 'GUI_EndDialog' on the current menu before I open up a new one... I initially was doing similar to you, using 'HideWindow()' for various windows as I went through menus, but it wasn't working right, and does eat up a ton of memory.

Doing the 'GUI_EndDialog()' on your current window will free up everything it was using...