Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Picture Module Info: (6 Items)
   
Picture Module Info  
I’m looking for info/documentation on low level/behind the scenes operation of picture modules; namely any memory 
issues. I have a pane that I am displaying different picture modules in. When I remove one module and replace it with 
another, I have not seen any documentation telling me I need to free the memory for the one I removed. Is it 
automatically cleaned up? Also, if the default behavior is to destroy a module when it is replaced, can this default 
behavior be overridden? I.e. is there a way to keep the current state (values of all its widgets) of a picture module so
 when it is reinserted into a container it will be in the state it was when replaced? If anyone could tell me where this
 info might be documented I would appreciate it.
Re: Picture Module Info  
I kind of answered my own question(s). You must call PtClearWidget() to remove one picture module from a container 
before inserting another. This function destroys anything in that container. So memory is released. Good for memory 
management, bad for keeping current info around. I created a bunch of global variables to write values to before calling
 PtClearWidget(). Then, after calling ApCreateModule(), you can get the previous values from these variables and rewrite
 them to the new picture before you ReRealize the container. Kind of a pain but doable. Also there seams there may be a 
better way to do this kind of thing with pictures and a widget database.
Re: Picture Module Info  
In order to preserve your widgets in their state you can try:
1. "move" your widgets in and out of an offscreen window (not a realized one)
2. "move" your widgets into negative/positive coordinates (and disable them -- to avoid focus issues) when needed.

Widgets will stay the same. But memory usage will suffer.
Re: Picture Module Info  
Interesting solution...I will give it a try. If you don't have many modules, should not be any memory issues. Thank you.
Re: Picture Module Info  
Misha,
  Your solution works good...as long as you use two different containers, one for each picture. The issue is when you 
call PtSetArg() & PtSetResources() for Pt_ARG_POS on a picture module; it applies the position to the container that 
holds the picture, not the picture. I.e. a picture module has no position; it gets the position of the container you put
 it in.  I guess you know this but I did not.
    I added a second PtPane for a container to put my second picture in and all is working well now. I move one 
container to some position larger than my base widget dimension and you can't see it any more, etc... The total hit on 
memory is only that of the size of all your pictures once they are all created with ApCreateModule(). After this, memory
 is not being consumed because you are not creating anything, just moving containers around.
Re: Picture Module Info  
Sorry, I assumed that you have a container already.